MiniAgda
Safe HaskellNone
LanguageHaskell98

TypeChecker

Synopsis

Documentation

traceCheck :: String -> a -> a Source #

traceCheckM :: Monad m => String -> m () Source #

traceSing :: String -> a -> a Source #

traceSingM :: Monad m => String -> m () Source #

traceAdm :: String -> a -> a Source #

traceAdmM :: Monad m => String -> m () Source #

echo :: MonadIO m => String -> m () Source #

echoR :: MonadIO m => String -> m () Source #

echoTySig :: (Show n, MonadIO m) => n -> Expr -> m () Source #

echoKindedTySig :: (Show n, MonadIO m) => Kind -> n -> Expr -> m () Source #

echoKindedDef :: (Show n, MonadIO m) => Kind -> n -> Expr -> m () Source #

echoTySigE :: (Show n, MonadIO m) => n -> Expr -> m () Source #

echoDefE :: (Show n, MonadIO m) => n -> Expr -> m () Source #

computeConstructorTele :: Telescope -> Type -> Type -> TypeCheck (Telescope, [Pattern]) Source #

computeConstructorTele dtel t = return ctel Computes the constructor telescope from the target.

checkConstructorParams :: [Expr] -> TVal -> TypeCheck (TCContext, [Pattern]) Source #

checkConstructorParams pars tv = return cxt Checks that parameters pars are patterns elimating the datatype tv. Returns a context cxt that binds the pattern variables in left-to-right order.

contextToTele :: TCContext -> TypeCheck Telescope Source #

Precondition: ce is included in the current context.

typeCheckConstructor :: Name -> Type -> Sized -> Co -> [Pol] -> Telescope -> Constructor -> TypeCheck (Bool, Kinded EConstructor) Source #

typeCheckConstructor d dt sz co pols tel (TypeSig c t)

returns True if constructor has recursive argument

checkLet :: Dec -> Name -> Telescope -> Maybe Type -> Expr -> Expr -> TVal -> TypeCheck (Kinded Extr) Source #

checkLet let .x tel : t = e1 in e2

checkLetDef :: Dec -> Telescope -> Maybe Type -> Expr -> TypeCheck (TVal, EType, Kinded Extr) Source #

checkLetDef .x tel : t = e becomes .x : tel -> t = tel -> e

checkPair :: Expr -> Expr -> Name -> Domain -> FVal -> TypeCheck (Kinded Expr) Source #

checkPair e1 e2 y dom env b checks Pair e1 e2 against VQuant Sigma y dom env b.

checkConTerm :: ConK -> QName -> [Expr] -> TVal -> TypeCheck (Kinded Extr) Source #

Check (partially applied) constructor term, eta-expand it and turn it into a named record.

maybeErase :: Polarity pol => pol -> Expr -> Expr Source #

checkApp :: Expr -> TVal -> TypeCheck (Kinded (Name, Extr), TVal) Source #

checking e against (x : A) -> B returns (x,e) and B[e/x]

Pattern checking ------------------------------------------------

type DotFlex = (Int, (Expr, Domain)) Source #

data Goal Source #

Constructors

DotFlex Int (Maybe Expr) Domain

Just : Flexible variable from inaccessible pattern. ^ Nothing : Flexible variable from hidden function type.

MaxMatches Int TVal 
DottedCons Dotted Pattern TVal 

Instances

Instances details
Show Goal Source # 
Instance details

Defined in TypeChecker

Methods

showsPrec :: Int -> Goal -> ShowS #

show :: Goal -> String #

showList :: [Goal] -> ShowS #

assignFlex :: Int -> Val -> TypeCheck Substitution Source #

Check occurrence and return singleton substitution.

instList :: [Pol] -> [Int] -> TVal -> [Val] -> [Val] -> TypeCheck Substitution Source #

instList' :: Int -> [Pol] -> [Int] -> TVal -> [Val] -> [Val] -> TypeCheck Substitution Source #

tailPosl :: [Pol] -> [Pol] Source #

isMeta :: [Int] -> Val -> Bool Source #

Substitution into values

class Substitute a where Source #

Overloaded substitution of values for generic values (free variables).

Instances

Instances details
Substitute SemCxt Source # 
Instance details

Defined in TypeChecker

Substitute Substitution Source # 
Instance details

Defined in TypeChecker

Substitute Env Source #

Substitute in environment.

Instance details

Defined in TypeChecker

Substitute Val Source # 
Instance details

Defined in TypeChecker

Substitute v => Substitute (Bound v) Source # 
Instance details

Defined in TypeChecker

Substitute v => Substitute (Dom v) Source # 
Instance details

Defined in TypeChecker

Substitute v => Substitute (Measure v) Source # 
Instance details

Defined in TypeChecker

Substitute v => Substitute (Sort v) Source # 
Instance details

Defined in TypeChecker

Substitute v => Substitute (OneOrTwo v) Source # 
Instance details

Defined in TypeChecker

Substitute v => Substitute (Maybe v) Source # 
Instance details

Defined in TypeChecker

Substitute v => Substitute [v] Source # 
Instance details

Defined in TypeChecker

Methods

substitute :: Substitution -> [v] -> TypeCheck [v] Source #

Substitute v => Substitute (Map k v) Source # 
Instance details

Defined in TypeChecker

Methods

substitute :: Substitution -> Map k v -> TypeCheck (Map k v) Source #

Substitute v => Substitute (x, v) Source # 
Instance details

Defined in TypeChecker

Methods

substitute :: Substitution -> (x, v) -> TypeCheck (x, v) Source #

compSubst :: Substitution -> Substitution -> TypeCheck Substitution Source #

"merge" substitutions by first applying the second to the first, then appending them t[sigma][tau] = t[sigma . tau]

Size checking

check wether the data type is sized type

szType :: Co -> Int -> TVal -> TypeCheck () Source #

constructors of sized type

lowerSemiCont :: Int -> TVal -> TypeCheck Bool Source #

Check whether a type is upper semi-continuous.

upperSemiCont :: Int -> TVal -> TypeCheck Bool Source #

Check whether a type is upper semi-continuous.

endsInSizedCo :: Int -> TVal -> TypeCheck () Source #

endsInSizedCo i tv checks that tv is lower semi-continuous in i and that tv[0/i] = Top.

endsInSizedCo' :: Bool -> Int -> TVal -> TypeCheck () Source #

endsInSizedCo' False i tv checks that tv is lower semi-continuous in i. endsInSizedCo' True i tv additionally checks that tv[0/i] = Top.

allTypesOfTuple :: TVal -> [Val] -> TVal -> [ConstructorInfo] -> (TVal -> TypeCheck ()) -> TypeCheck () Source #

allTypesOfTyples args dv cis check performs check on all component types of tuple type tv = d args where dv is the type of d.

allComponentTypes :: [FieldInfo] -> Env -> (TVal -> TypeCheck ()) -> TypeCheck () Source #

allComponentTypes fis env check applies check to all field types in fis (evaluated wrt to environment env). Erased fields are skipped. (Is this correct?)

data CoFunType Source #

Constructors

CoFun 
SizedCoFun Int 

addJob :: Int -> TVal -> (Int -> TypeCheck ()) -> Int -> TypeCheck () Source #

szMono :: Co -> Int -> TVal -> TypeCheck () Source #