Copyright | (c) 2013-2016 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- tcModule :: Module Name -> InferInput -> IO (InferOutput Module)
- tcModuleInst :: Module -> Module Name -> InferInput -> IO (InferOutput Module)
- tcExpr :: Expr Name -> InferInput -> IO (InferOutput (Expr, Schema))
- tcDecls :: FromDecl d => [d] -> InferInput -> IO (InferOutput [DeclGroup])
- data InferInput = InferInput {
- inpRange :: Range
- inpVars :: Map Name Schema
- inpTSyns :: Map Name TySyn
- inpNewtypes :: Map Name Newtype
- inpAbstractTypes :: Map Name AbstractType
- inpParamTypes :: !(Map Name ModTParam)
- inpParamConstraints :: ![Located Prop]
- inpParamFuns :: !(Map Name ModVParam)
- inpNameSeeds :: NameSeeds
- inpMonoBinds :: Bool
- inpSolverConfig :: SolverConfig
- inpSearchPath :: [FilePath]
- inpPrimNames :: !PrimMap
- inpSupply :: !Supply
- data InferOutput a
- data SolverConfig = SolverConfig {
- solverPath :: FilePath
- solverArgs :: [String]
- solverVerbose :: Int
- solverPreludePath :: [FilePath]
- data NameSeeds
- nameSeeds :: NameSeeds
- data Error
- = KindMismatch (Maybe TypeSource) Kind Kind
- | TooManyTypeParams Int Kind
- | TyVarWithParams
- | TooManyTySynParams Name Int
- | TooFewTyParams Name Int
- | RecursiveTypeDecls [Name]
- | TypeMismatch TypeSource Type Type
- | RecursiveType TypeSource Type Type
- | UnsolvedGoals [Goal]
- | UnsolvableGoals [Goal]
- | UnsolvedDelayedCt DelayedCt
- | UnexpectedTypeWildCard
- | TypeVariableEscaped TypeSource Type [TParam]
- | NotForAll TypeSource TVar Type
- | TooManyPositionalTypeParams
- | CannotMixPositionalAndNamedTypeParams
- | UndefinedTypeParameter (Located Ident)
- | RepeatedTypeParameter Ident [Range]
- | AmbiguousSize TVarInfo (Maybe Type)
- | UndefinedExistVar Name
- | TypeShadowing String Name String
- | MissingModTParam (Located Ident)
- | MissingModVParam (Located Ident)
- data Warning
- ppWarning :: (Range, Warning) -> Doc
- ppError :: (Range, Error) -> Doc
- data WithNames a = WithNames a NameMap
- type NameMap = IntMap String
- ppNamedWarning :: NameMap -> (Range, Warning) -> Doc
- ppNamedError :: NameMap -> (Range, Error) -> Doc
Documentation
tcModule :: Module Name -> InferInput -> IO (InferOutput Module) Source #
:: Module | functor |
-> Module Name | |
-> InferInput | TC settings |
-> IO (InferOutput Module) | new version of instance |
Check a module instantiation, assuming that the functor has already been checked.
tcExpr :: Expr Name -> InferInput -> IO (InferOutput (Expr, Schema)) Source #
tcDecls :: FromDecl d => [d] -> InferInput -> IO (InferOutput [DeclGroup]) Source #
data InferInput Source #
Information needed for type inference.
InferInput | |
|
Instances
Show InferInput Source # | |
Defined in Cryptol.TypeCheck.Monad showsPrec :: Int -> InferInput -> ShowS # show :: InferInput -> String # showList :: [InferInput] -> ShowS # |
data InferOutput a Source #
The results of type inference.
InferFailed NameMap [(Range, Warning)] [(Range, Error)] | We found some errors |
InferOK NameMap [(Range, Warning)] NameSeeds Supply a | Type inference was successful. |
Instances
Show a => Show (InferOutput a) Source # | |
Defined in Cryptol.TypeCheck.Monad showsPrec :: Int -> InferOutput a -> ShowS # show :: InferOutput a -> String # showList :: [InferOutput a] -> ShowS # |
data SolverConfig Source #
SolverConfig | |
|
Instances
This is used for generating various names.
Instances
Show NameSeeds Source # | |
Generic NameSeeds Source # | |
NFData NameSeeds Source # | |
Defined in Cryptol.TypeCheck.Monad | |
type Rep NameSeeds Source # | |
Defined in Cryptol.TypeCheck.Monad type Rep NameSeeds = D1 ('MetaData "NameSeeds" "Cryptol.TypeCheck.Monad" "cryptol-2.10.0-Bsi6VMfJ6GCFlOdda30jWW" 'False) (C1 ('MetaCons "NameSeeds" 'PrefixI 'True) (S1 ('MetaSel ('Just "seedTVar") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "seedGoal") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int))) |
nameSeeds :: NameSeeds Source #
The initial seeds, used when checking a fresh program. XXX: why does this start at 10?
Various errors that might happen during type checking/inference
KindMismatch (Maybe TypeSource) Kind Kind | Expected kind, inferred kind |
TooManyTypeParams Int Kind | Number of extra parameters, kind of result
(which should not be of the form |
TyVarWithParams | A type variable was applied to some arguments. |
TooManyTySynParams Name Int | Type-synonym, number of extra params |
TooFewTyParams Name Int | Who is missing params, number of missing params |
RecursiveTypeDecls [Name] | The type synonym declarations are recursive |
TypeMismatch TypeSource Type Type | Expected type, inferred type |
RecursiveType TypeSource Type Type | Unification results in a recursive type |
UnsolvedGoals [Goal] | A constraint that we could not solve, usually because there are some left-over variables that we could not infer. |
UnsolvableGoals [Goal] | A constraint that we could not solve and we know it is impossible to do it. |
UnsolvedDelayedCt DelayedCt | A constraint (with context) that we could not solve |
UnexpectedTypeWildCard | Type wild cards are not allowed in this context (e.g., definitions of type synonyms). |
TypeVariableEscaped TypeSource Type [TParam] | Unification variable depends on quantified variables that are not in scope. |
NotForAll TypeSource TVar Type | Quantified type variables (of kind *) need to match the given type, so it does not work for all types. |
TooManyPositionalTypeParams | Too many positional type arguments, in an explicit type instantiation |
CannotMixPositionalAndNamedTypeParams | |
UndefinedTypeParameter (Located Ident) | |
RepeatedTypeParameter Ident [Range] | |
AmbiguousSize TVarInfo (Maybe Type) | Could not determine the value of a numeric type variable, but we know it must be at least as large as the given type (or unconstrained, if Nothing). |
UndefinedExistVar Name | |
TypeShadowing String Name String | |
MissingModTParam (Located Ident) | |
MissingModVParam (Located Ident) |
Instances
Instances
This packages together a type with some names to be used to display the variables. It is used for pretty printing types.
Instances
PP (WithNames Newtype) Source # | |
PP (WithNames TySyn) Source # | |
PP (WithNames TVar) Source # | |
PP (WithNames Type) Source # | The precedence levels used by this pretty-printing instance correspond with parser non-terminals as follows:
|
PP (WithNames TParam) Source # | |
PP (WithNames Schema) Source # | |
PP (WithNames DeclDef) Source # | |
PP (WithNames Decl) Source # | |
PP (WithNames DeclGroup) Source # | |
PP (WithNames Match) Source # | |
PP (WithNames Expr) Source # | |
PP (WithNames Module) Source # | |
PP (WithNames Subst) Source # | |
PP (WithNames DelayedCt) Source # | |
PP (WithNames Goal) Source # | |
PP (WithNames Error) Source # | |
PP (WithNames Warning) Source # | |