Safe Haskell | None |
---|
- readTypeRef :: TypeVarRef -> TypeCheckMonad (Either (TypeVar, [Constraint]) Type)
- writeTypeRef :: TypeVarRef -> Type -> TypeCheckMonad ()
- freshTypeVar :: MonadIO m => m Type
- freshTypeVarWithConstraints :: MonadIO m => [Constraint] -> m Type
- getType :: Name -> TypeCheckMonad TypeScheme
- setType :: Name -> TypeScheme -> TypeCheckMonad ()
- isTypeUnsafe :: Name -> TypeCheckMonad Bool
- markTypeAsUnsafe :: Name -> TypeCheckMonad ()
- replacementForDeprecatedName :: Name -> TypeCheckMonad (Maybe Name)
- isDeprecated :: Name -> TypeCheckMonad Bool
- markAsDeprecated :: Name -> Maybe Name -> TypeCheckMonad ()
- compress :: Type -> TypeCheckMonad Type
- compressTypeScheme :: TypeScheme -> TypeCheckMonad TypeScheme
- type TypeCheckMonad = StateT TypeInferenceState IO
- runTypeChecker :: TypeInferenceState -> TypeCheckMonad a -> IO a
- newTypeInferenceState :: TypeInferenceState
- data TypeInferenceState = TypeInferenceState {
- environment :: Environment
- srcSpan :: SrcSpan
- errorContexts :: [ErrorContext]
- errors :: [ErrorMessage]
- warnings :: [ErrorMessage]
- unificationStack :: [(Type, Type)]
- definitionStack :: [Name]
- inError :: Bool
- symUnificationAllowed :: Bool
- comparableForEqualityDataTypes :: [Name]
- errorOptions :: ErrorOptions
- getState :: TypeCheckMonad TypeInferenceState
- local :: [Name] -> TypeCheckMonad a -> TypeCheckMonad a
- getEnvironment :: TypeCheckMonad Environment
- type ErrorContext = Doc
- addErrorContext :: ErrorContext -> TypeCheckMonad a -> TypeCheckMonad a
- getErrorContexts :: TypeCheckMonad [ErrorContext]
- getSrcSpan :: TypeCheckMonad SrcSpan
- setSrcSpan :: SrcSpan -> TypeCheckMonad a -> TypeCheckMonad a
- getUnificationStack :: TypeCheckMonad [(Type, Type)]
- addUnificationPair :: (Type, Type) -> TypeCheckMonad a -> TypeCheckMonad a
- symmetricUnificationAllowed :: TypeCheckMonad Bool
- disallowSymmetricUnification :: TypeCheckMonad a -> TypeCheckMonad a
- getInError :: TypeCheckMonad Bool
- setInError :: Bool -> TypeCheckMonad a -> TypeCheckMonad a
- resetWarnings :: TypeCheckMonad ()
- getWarnings :: TypeCheckMonad [ErrorMessage]
- addWarning :: (ErrorOptions -> Bool) -> Warning -> TypeCheckMonad ()
- markDatatypeAsComparableForEquality :: Name -> TypeCheckMonad ()
- datatypeIsComparableForEquality :: Name -> TypeCheckMonad Bool
- unmarkDatatypeAsComparableForEquality :: Name -> TypeCheckMonad ()
- modifyErrorOptions :: (ErrorOptions -> ErrorOptions) -> TypeCheckMonad ()
- addDefinitionName :: Name -> TypeCheckMonad a -> TypeCheckMonad a
- getDefinitionStack :: TypeCheckMonad [Name]
- raiseMessageAsError :: Error -> TypeCheckMonad a
- raiseMessagesAsError :: [Error] -> TypeCheckMonad a
- panic :: String -> a
- manyErrorsIfFalse :: Bool -> [Error] -> TypeCheckMonad ()
- errorIfFalseM :: TypeCheckMonad Bool -> Error -> TypeCheckMonad ()
- errorIfFalse :: Bool -> Error -> TypeCheckMonad ()
- tryAndRecover :: Bool -> TypeCheckMonad a -> TypeCheckMonad a -> TypeCheckMonad a
- failM :: TypeCheckMonad a
Documentation
readTypeRef :: TypeVarRef -> TypeCheckMonad (Either (TypeVar, [Constraint]) Type)Source
writeTypeRef :: TypeVarRef -> Type -> TypeCheckMonad ()Source
freshTypeVar :: MonadIO m => m TypeSource
freshTypeVarWithConstraints :: MonadIO m => [Constraint] -> m TypeSource
getType :: Name -> TypeCheckMonad TypeSchemeSource
Get the type of n
and throw an exception if it doesn't exist.
setType :: Name -> TypeScheme -> TypeCheckMonad ()Source
Sets the type of n to be t in the current scope only. No unification is performed.
markTypeAsUnsafe :: Name -> TypeCheckMonad ()Source
markAsDeprecated :: Name -> Maybe Name -> TypeCheckMonad ()Source
compress :: Type -> TypeCheckMonad TypeSource
Takes a type and compresses the type by reading all type variables and if they point to another type, it returns that type instead.
compressTypeScheme :: TypeScheme -> TypeCheckMonad TypeSchemeSource
Apply compress to the type of a type scheme.
type TypeCheckMonad = StateT TypeInferenceState IOSource
runTypeChecker :: TypeInferenceState -> TypeCheckMonad a -> IO aSource
Runs the typechecker, starting from state st
. If any errors are
encountered then a SourceError
will be thrown with the relevent
error messages.
data TypeInferenceState Source
TypeInferenceState | |
|
local :: [Name] -> TypeCheckMonad a -> TypeCheckMonad aSource
type ErrorContext = DocSource
addErrorContext :: ErrorContext -> TypeCheckMonad a -> TypeCheckMonad aSource
setSrcSpan :: SrcSpan -> TypeCheckMonad a -> TypeCheckMonad aSource
Sets the SrcSpan only within prog.
addUnificationPair :: (Type, Type) -> TypeCheckMonad a -> TypeCheckMonad aSource
setInError :: Bool -> TypeCheckMonad a -> TypeCheckMonad aSource
addWarning :: (ErrorOptions -> Bool) -> Warning -> TypeCheckMonad ()Source
modifyErrorOptions :: (ErrorOptions -> ErrorOptions) -> TypeCheckMonad ()Source
addDefinitionName :: Name -> TypeCheckMonad a -> TypeCheckMonad aSource
raiseMessagesAsError :: [Error] -> TypeCheckMonad aSource
Report a message as an error
manyErrorsIfFalse :: Bool -> [Error] -> TypeCheckMonad ()Source
errorIfFalseM :: TypeCheckMonad Bool -> Error -> TypeCheckMonad ()Source
errorIfFalse :: Bool -> Error -> TypeCheckMonad ()Source
Report the error if first parameter is False.
tryAndRecover :: Bool -> TypeCheckMonad a -> TypeCheckMonad a -> TypeCheckMonad aSource