cryptol-2.2.4: Cryptol: The Language of Cryptography

Copyright(c) 2013-2015 Galois, Inc.
LicenseBSD3
Maintainercryptol@galois.com
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Cryptol.TypeCheck.Infer

Description

Assumes that the NoPat pass has been run.

Synopsis

Documentation

appTys :: Expr -> [Located (Maybe QName, Type)] -> Type -> InferM Expr Source

Infer the type of an expression with an explicit instantiation.

inferE :: Doc -> Expr -> InferM (Expr, Type) Source

We use this when we want to ensure that the expr has exactly (syntactically) the given type.

checkE :: Expr -> Type -> InferM Expr Source

Infer the type of an expression, and translate it to a fully elaborated core term.

expectRec :: [Named a] -> Type -> InferM [(Name, a, Type)] Source

smallest :: [Type] -> InferM Type Source

The type the is the smallest of all

inferP :: Doc -> Pattern -> InferM (QName, Located Type) Source

Infer the type of a pattern. Assumes that the pattern will be just a variable.

inferMatch :: Match -> InferM (Match, QName, Located Type, Type) Source

Infer the type of one match in a list comprehension.

inferCArm :: Int -> [Match] -> InferM ([Match], Map QName (Located Type), Type) Source

Infer the type of one arm of a list comprehension.

inferBinds :: Bool -> Bool -> [Bind] -> InferM [Decl] Source

inferBinds isTopLevel isRec binds performs inference for a strongly-connected component of Binds. If isTopLevel is true, any bindings without type signatures will be generalized. If it is false, and the mono-binds flag is enabled, no bindings without type signatures will be generalized, but bindings with signatures will be unaffected.

guessType :: Map QName Expr -> Bind -> InferM ((QName, VarType), Either (InferM Decl) (InferM Decl)) Source

Come up with a type for recursive calls to a function, and decide how we are going to be checking the binding. Returns: (Name, type or schema, computation to check binding)

The exprMap is a thunk where we can lookup the final expressions and we should be careful not to force it.

simpMonoBind :: OrdFacts -> Decl -> Decl Source

Try to evaluate the inferred type of a mono-binding

generalize :: [Decl] -> [Goal] -> InferM [Decl] Source

The inputs should be declarations with monomorphic types (i.e., of the form `Forall [] [] t`).

inferDs :: FromDecl d => [d] -> ([DeclGroup] -> InferM a) -> InferM a Source