Safe Haskell | None |
---|
- data TypeVar
- data TypeScheme = ForAll {
- typeSchemeVariables :: [(TypeVar, [Constraint])]
- typeSchemeType :: Type
- data Constraint
- = CEq
- | COrd
- | CInputable
- | CSet
- | CYieldable
- data Type
- data TypeVarRef
- = TypeVarRef {
- typeVar :: TypeVar
- constraints :: [Constraint]
- typePointer :: PType
- | RigidTypeVarRef {
- typeVar :: TypeVar
- constraints :: [Constraint]
- rigidName :: Name
- = TypeVarRef {
- prettyPrintTypes :: [Type] -> [Doc]
- isRigid :: TypeVarRef -> Bool
- constraintImpliedBy :: Constraint -> Constraint -> Bool
- reduceConstraints :: [Constraint] -> [Constraint]
- collectConstraints :: Type -> [(TypeVarRef, [Constraint])]
- freshTypeVar :: MonadIO m => m Type
- freshTypeVarWithConstraints :: MonadIO m => [Constraint] -> m Type
- freshTypeVarRef :: MonadIO m => [Constraint] -> m TypeVarRef
- freshRigidTypeVarWithConstraints :: MonadIO m => Name -> [Constraint] -> m Type
- type SymbolTable = PartialFunction Name TypeScheme
- type PSymbolTable = IORef SymbolTable
- freshPSymbolTable :: MonadIO m => m PSymbolTable
- readPSymbolTable :: MonadIO m => PSymbolTable -> m SymbolTable
- setPSymbolTable :: MonadIO m => PSymbolTable -> SymbolTable -> m ()
- type PType = IORef (Maybe Type)
- freshPType :: MonadIO m => m PType
- readPType :: MonadIO m => PType -> m (Maybe Type)
- setPType :: MonadIO m => PType -> Type -> m ()
Data Structures
data TypeScheme Source
ForAll | |
|
data Constraint Source
CEq | Comparable for equality |
COrd | Orderable |
CInputable | Can be input on a channel |
CSet | Can form sets of the type. |
CYieldable | Is something that can be yielded on the right hand side of =>. |
TVar TypeVarRef | |
TProc | |
TInt | |
TBool | |
TChar | |
TEvent | |
TExtendable | Something that can be extended via some means to a given type. After type-checking, the TypeVarRef will simply be a variable that contains Nothing. This means that it can be converted into an explicit TDotable via some unknown means, or directly to the return type. The variable argument here has a slightly special role during unification. If it contains Nothing then this is extendable via some unknown means to the specified type. If it contains a TDotable argt rt, then we know that one of the arguments is argt, and the remaining arguments are rt, which must either be a Dotable or a variable. The meaning in the former sense is recursive, the meaning in the latter case is clear. If it contains TVar tvref, then this means tvref has replaced this argument variable. We need to do the above as we may have multiple things that are extendable in the same way, so we need to sync the arguments together. |
TExtendableEmptyDotList | This type is used only during type-checking, and is guaranteed to only ever appear at the top-level of the left-hand side of a TExtendable. |
TSet Type | |
TSeq Type | |
TDot Type Type | |
TMap | |
| |
TTuple [Type] | |
TFunction [Type] Type | |
TDotable Type Type | |
TDatatype Name |
Eq Type | |
Ord Type | |
Show Type | |
Precedence Type | |
PrettyPrintable Type | |
Desugarable Type | |
(Applicative m, Monad m) => MonadicPrettyPrintable m TCExp | |
TypeCheckable Literal Type | |
TypeCheckable TCSType Type | |
TypeCheckable TCExp Type | |
TypeCheckable TCPat Type | |
TypeCheckable TCMatch Type | |
TypeCheckable TCDecl [(Name, Type)] | |
TypeCheckable TCDataTypeClause (Name, [Type]) | |
TypeCheckable (SType Name) Type | |
TypeCheckable (Pat Name) Type | |
TypeCheckable (Match Name) Type | |
TypeCheckable (Exp Name) Type | |
TypeCheckable (Decl Name) [(Name, Type)] | |
TypeCheckable (DataTypeClause Name) (Name, [Type]) | |
Desugarable a => Desugarable (Annotated (Maybe Type, PType) a) | |
Compressable a => Compressable (Annotated (Maybe Type, PType) a) |
data TypeVarRef Source
TypeVarRef | |
| |
RigidTypeVarRef | |
|
prettyPrintTypes :: [Type] -> [Doc]Source
Pretty prints several types using the same variable substitutions
isRigid :: TypeVarRef -> BoolSource
reduceConstraints :: [Constraint] -> [Constraint]Source
collectConstraints :: Type -> [(TypeVarRef, [Constraint])]Source
Creation of Types
freshTypeVar :: MonadIO m => m TypeSource
freshTypeVarWithConstraints :: MonadIO m => [Constraint] -> m TypeSource
freshTypeVarRef :: MonadIO m => [Constraint] -> m TypeVarRefSource
freshRigidTypeVarWithConstraints :: MonadIO m => Name -> [Constraint] -> m TypeSource
Symbol Tables
type PSymbolTable = IORef SymbolTableSource
freshPSymbolTable :: MonadIO m => m PSymbolTableSource
readPSymbolTable :: MonadIO m => PSymbolTable -> m SymbolTableSource
setPSymbolTable :: MonadIO m => PSymbolTable -> SymbolTable -> m ()Source
Type Pointers
freshPType :: MonadIO m => m PTypeSource