Safe Haskell | None |
---|---|
Language | Haskell98 |
Monads for type checking and type inference and associated data types
- bindNames :: MonadState CheckState m => Map (ModuleName, Ident) (Type, NameKind, NameVisibility) -> m a -> m a
- bindTypes :: MonadState CheckState m => Map (Qualified ProperName) (Kind, TypeKind) -> m a -> m a
- withScopedTypeVars :: (Functor m, MonadState CheckState m) => ModuleName -> [(String, Kind)] -> m a -> m a
- withTypeClassDictionaries :: MonadState CheckState m => [TypeClassDictionaryInScope] -> m a -> m a
- getTypeClassDictionaries :: (Functor m, MonadState CheckState m) => m (Map (Maybe ModuleName) (Map (Qualified ProperName) (Map (Qualified Ident) TypeClassDictionaryInScope)))
- lookupTypeClassDictionaries :: (Functor m, MonadState CheckState m) => Maybe ModuleName -> m (Map (Qualified ProperName) (Map (Qualified Ident) TypeClassDictionaryInScope))
- bindLocalVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(Ident, Type, NameVisibility)] -> m a -> m a
- bindLocalTypeVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(ProperName, Kind)] -> m a -> m a
- makeBindingGroupVisible :: (Functor m, MonadState CheckState m) => m ()
- withBindingGroupVisible :: (Functor m, MonadState CheckState m) => m a -> m a
- preservingNames :: (Functor m, MonadState CheckState m) => m a -> m a
- lookupVariable :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m Type
- getVisibility :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m NameVisibility
- checkVisibility :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m ()
- lookupTypeVariable :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified ProperName -> m Kind
- data CheckState = CheckState {}
- newtype Check a = Check {}
- getEnv :: (Functor m, MonadState CheckState m) => m Environment
- putEnv :: MonadState CheckState m => Environment -> m ()
- modifyEnv :: MonadState CheckState m => (Environment -> Environment) -> m ()
- runCheck :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Check a -> m (a, Environment)
- runCheck' :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Environment -> Check a -> m (a, Environment)
- guardWith :: MonadError e m => e -> Bool -> m ()
- freshDictionaryName :: Check Int
- liftCheck :: Check a -> UnifyT t Check a
- liftUnify :: Partial t => UnifyT t Check a -> Check (a, Substitution t)
- liftUnifyWarnings :: Partial t => (Substitution t -> ErrorMessage -> ErrorMessage) -> UnifyT t Check a -> Check (a, Substitution t)
Documentation
bindNames :: MonadState CheckState m => Map (ModuleName, Ident) (Type, NameKind, NameVisibility) -> m a -> m a Source
Temporarily bind a collection of names to values
bindTypes :: MonadState CheckState m => Map (Qualified ProperName) (Kind, TypeKind) -> m a -> m a Source
Temporarily bind a collection of names to types
withScopedTypeVars :: (Functor m, MonadState CheckState m) => ModuleName -> [(String, Kind)] -> m a -> m a Source
Temporarily bind a collection of names to types
withTypeClassDictionaries :: MonadState CheckState m => [TypeClassDictionaryInScope] -> m a -> m a Source
Temporarily make a collection of type class dictionaries available
getTypeClassDictionaries :: (Functor m, MonadState CheckState m) => m (Map (Maybe ModuleName) (Map (Qualified ProperName) (Map (Qualified Ident) TypeClassDictionaryInScope))) Source
Get the currently available map of type class dictionaries
lookupTypeClassDictionaries :: (Functor m, MonadState CheckState m) => Maybe ModuleName -> m (Map (Qualified ProperName) (Map (Qualified Ident) TypeClassDictionaryInScope)) Source
Lookup type class dictionaries in a module.
bindLocalVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(Ident, Type, NameVisibility)] -> m a -> m a Source
Temporarily bind a collection of names to local variables
bindLocalTypeVariables :: (Functor m, MonadState CheckState m) => ModuleName -> [(ProperName, Kind)] -> m a -> m a Source
Temporarily bind a collection of names to local type variables
makeBindingGroupVisible :: (Functor m, MonadState CheckState m) => m () Source
Update the visibility of all names to Defined
withBindingGroupVisible :: (Functor m, MonadState CheckState m) => m a -> m a Source
Update the visibility of all names to Defined in the scope of the provided action
preservingNames :: (Functor m, MonadState CheckState m) => m a -> m a Source
Perform an action while preserving the names from the Environment
.
lookupVariable :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m Type Source
Lookup the type of a value by name in the Environment
getVisibility :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m NameVisibility Source
Lookup the visibility of a value by name in the Environment
checkVisibility :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified Ident -> m () Source
Assert that a name is visible
lookupTypeVariable :: (e ~ MultipleErrors, Functor m, MonadState CheckState m, MonadError e m) => ModuleName -> Qualified ProperName -> m Kind Source
Lookup the kind of a type by name in the Environment
data CheckState Source
State required for type checking:
CheckState | |
|
The type checking monad, which provides the state of the type checker, and error reporting capabilities
getEnv :: (Functor m, MonadState CheckState m) => m Environment Source
Get the current Environment
putEnv :: MonadState CheckState m => Environment -> m () Source
Update the Environment
modifyEnv :: MonadState CheckState m => (Environment -> Environment) -> m () Source
Modify the Environment
runCheck :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Check a -> m (a, Environment) Source
Run a computation in the Check monad, starting with an empty Environment
runCheck' :: (MonadError MultipleErrors m, MonadWriter MultipleErrors m) => Environment -> Check a -> m (a, Environment) Source
Run a computation in the Check monad, failing with an error, or succeeding with a return value and the final Environment
.
guardWith :: MonadError e m => e -> Bool -> m () Source
Make an assertion, failing with an error message
freshDictionaryName :: Check Int Source
Generate new type class dictionary name
liftCheck :: Check a -> UnifyT t Check a Source
Lift a computation in the Check
monad into the substitution monad.
liftUnify :: Partial t => UnifyT t Check a -> Check (a, Substitution t) Source
Run a computation in the substitution monad, generating a return value and the final substitution.
liftUnifyWarnings :: Partial t => (Substitution t -> ErrorMessage -> ErrorMessage) -> UnifyT t Check a -> Check (a, Substitution t) Source
Run a computation in the substitution monad, generating a return value, the final substitution and updating warnings values.