Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The rules for checking types.
Synopsis
- data TVarBinding
- = Syn [TVar] Type
- | Self {
- _guardedness :: Guardedness
- arguments :: Maybe [TVar]
- | Bound
- guardedness :: Traversal' TVarBinding Guardedness
- type TEnvironment = Map TVar TVarBinding
- type MonadCheckType m = (MonadReader TEnvironment m, MonadError String m)
- guard :: Guardedness -> Guardedness
- checkType :: MonadCheckType m => Type -> m (Type, First TVar)
- checkPolytype :: MonadCheckType m => Polytype -> m Polytype
- checkTypeSynonym :: MonadCheckType m => TVar -> [TVar] -> Type -> m Type
Documentation
data TVarBinding Source #
Things a type variable can refer to
Syn [TVar] Type | A type synonym (with a list of arguments) |
Self | A fixed point |
| |
Bound | Anything else |
type TEnvironment = Map TVar TVarBinding Source #
type MonadCheckType m = (MonadReader TEnvironment m, MonadError String m) Source #
guard :: Guardedness -> Guardedness Source #
Going under a ▸
checkType :: MonadCheckType m => Type -> m (Type, First TVar) Source #
Check that a type is well-formed and expand type synonyms. This handles desugaring recursive uses of type synonyms to fixed points: if the current type synonym is used (and applied to the same arguments), the second return value contains the fixed point variable to abstract over.
checkPolytype :: MonadCheckType m => Polytype -> m Polytype Source #
Check a polytype
checkTypeSynonym :: MonadCheckType m => TVar -> [TVar] -> Type -> m Type Source #
Check a type synonym definition