Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains functions for converting between type expressions and type schemes.
Synopsis
- instantiateTypeScheme :: TypeScheme -> Converter Type
- instantiateTypeScheme' :: TypeScheme -> Converter (Type, [Type])
- abstractTypeScheme :: [QName] -> Type -> TypeScheme
- abstractTypeScheme' :: [QName] -> Type -> (TypeScheme, Subst Type)
Instantiating Type Schemes
instantiateTypeScheme :: TypeScheme -> Converter Type Source #
Replaces the type variables in the given type scheme by fresh type variables.
instantiateTypeScheme' :: TypeScheme -> Converter (Type, [Type]) Source #
Like instantiateTypeScheme
but also returns the fresh type variables,
the type scheme has been instantiated with.
Abstracting Type Expressions
abstractTypeScheme :: [QName] -> Type -> TypeScheme Source #
Normalizes the names of type variables in the given type and returns it as a type scheme.
The first argument contains the names of type variables that should be
bound by the type scheme. Usually these are the type variables that
occur in the given type (see freeTypeVars
).
Fresh type variables used by the given type are replaced by regular type
variables with the prefix freshTypeArgPrefix
. All other type variables
are not renamed.
abstractTypeScheme' :: [QName] -> Type -> (TypeScheme, Subst Type) Source #
Like abstractTypeScheme
but returns the resulting type scheme and the
substitution that replaces the abstracted type variables by their name in
the type scheme.