Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- infer :: Map Variable Type -> Expression -> [TypeVariable] -> Type
- check :: MonadState [TypeVariable] m => Map Variable Type -> Expression -> m (Type, Set (Type, Type))
- generateTypeVariable :: MonadState [TypeVariable] m => m TypeVariable
- unify :: Monad m => [(Type, Type)] -> m (Map TypeVariable Type)
- unifyVariable :: Monad m => TypeVariable -> [(Type, Type)] -> Type -> Type -> m (Map TypeVariable Type)
- occurs :: TypeVariable -> Type -> Bool
- substitute :: Map TypeVariable Type -> [(Type, Type)] -> [(Type, Type)]
- replace :: Map TypeVariable Type -> Type -> Type
- quote :: Text -> Text
Documentation
infer :: Map Variable Type -> Expression -> [TypeVariable] -> Type Source #
Get the type of the expression.
check :: MonadState [TypeVariable] m => Map Variable Type -> Expression -> m (Type, Set (Type, Type)) Source #
Check the exp with the given context.
generateTypeVariable :: MonadState [TypeVariable] m => m TypeVariable Source #
Generate a fresh type variable.
unify :: Monad m => [(Type, Type)] -> m (Map TypeVariable Type) Source #
Unify the list of constraints.
unifyVariable :: Monad m => TypeVariable -> [(Type, Type)] -> Type -> Type -> m (Map TypeVariable Type) Source #
Unify a type variable for two types.
substitute :: Map TypeVariable Type -> [(Type, Type)] -> [(Type, Type)] Source #
Substitute the unified type into the constraints.