Copyright | (c) 2013-2016 Galois Inc. |
---|---|
License | BSD3 |
Maintainer | cryptol@galois.com |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
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
- 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
- = ErrorMsg Doc
- | KindMismatch Kind Kind
- | TooManyTypeParams Int Kind
- | TyVarWithParams
- | TooManyTySynParams Name Int
- | TooFewTySynParams Name Int
- | RecursiveTypeDecls [Name]
- | TypeMismatch Type Type
- | RecursiveType Type Type
- | UnsolvedGoals Bool [Goal]
- | UnsolvedDelayedCt DelayedCt
- | UnexpectedTypeWildCard
- | TypeVariableEscaped Type [TParam]
- | NotForAll TVar Type
- | TooManyPositionalTypeParams
- | CannotMixPositionalAndNamedTypeParams
- | UndefinedTypeParameter (Located Ident)
- | RepeatedTypeParameter Ident [Range]
- data Warning
- ppWarning :: (Range, Warning) -> Doc
- ppError :: (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 [(Range, Warning)] [(Range, Error)] | We found some errors |
InferOK [(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.7.0-6VD9sMh08R1JPrYSq7DH8b" 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
ErrorMsg Doc | Just say this |
KindMismatch 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 |
TooFewTySynParams Name Int | Type-synonym, number of missing params |
RecursiveTypeDecls [Name] | The type synonym declarations are recursive |
TypeMismatch Type Type | Expected type, inferred type |
RecursiveType Type Type | Unification results in a recursive type |
UnsolvedGoals Bool [Goal] | A constraint that we could not solve The boolean indicates if we know that this constraint is impossible. |
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 Type [TParam] | Unification variable depends on quantified variables that are not in scope. |
NotForAll 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] |