Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Generalization of type schemes
Synopsis
- generalize :: forall m t. UnifyGen m t => (UVarOf m # t) -> m (GTerm (UVarOf m) # t)
- instantiate :: UnifyGen m t => (GTerm (UVarOf m) # t) -> m (UVarOf m # t)
- data GTerm v ast
- _GMono :: forall v ast. Prism' (GTerm v ast) (v ast)
- _GPoly :: forall v ast. Prism' (GTerm v ast) (v ast)
- _GBody :: forall v ast. Prism' (GTerm v ast) ((:#) ast (GTerm v))
- data W_GTerm (v :: AHyperType -> Type) node where
- instantiateWith :: forall m t a. UnifyGen m t => m a -> (forall n. TypeConstraintsOf n -> UTerm (UVarOf m) # n) -> (GTerm (UVarOf m) # t) -> m (UVarOf m # t, a)
- instantiateForAll :: forall m t. UnifyGen m t => (TypeConstraintsOf t -> UTerm (UVarOf m) # t) -> (UVarOf m # t) -> WriterT [m ()] m (UVarOf m # t)
- instantiateH :: forall m t. UnifyGen m t => (forall n. TypeConstraintsOf n -> UTerm (UVarOf m) # n) -> (GTerm (UVarOf m) # t) -> WriterT [m ()] m (UVarOf m # t)
Documentation
generalize :: forall m t. UnifyGen m t => (UVarOf m # t) -> m (GTerm (UVarOf m) # t) Source #
Generalize a unification term pointed by the given variable to a GTerm
.
Unification variables that are scoped within the term
become universally quantified skolems.
instantiate :: UnifyGen m t => (GTerm (UVarOf m) # t) -> m (UVarOf m # t) Source #
Instantiate a generalized type with fresh unification variables for the quantified variables
An efficient representation of a type scheme arising from generalizing a unification term. Type subexpressions which are completely monomoprhic are tagged as such, to avoid redundant instantation and unification work
GMono (v ast) | Completely monomoprhic term |
GPoly (v ast) | Points to a quantified variable (instantiation will
create fresh unification terms) ( |
GBody (ast :# GTerm v) | Term with some polymorphic parts |
Instances
data W_GTerm (v :: AHyperType -> Type) node where Source #
instantiateWith :: forall m t a. UnifyGen m t => m a -> (forall n. TypeConstraintsOf n -> UTerm (UVarOf m) # n) -> (GTerm (UVarOf m) # t) -> m (UVarOf m # t, a) Source #
instantiateForAll :: forall m t. UnifyGen m t => (TypeConstraintsOf t -> UTerm (UVarOf m) # t) -> (UVarOf m # t) -> WriterT [m ()] m (UVarOf m # t) Source #
Exports for SPECIALIZE
pragmas.