free-compiler-0.3.0.0: A Haskell to Coq compiler.

Safe HaskellNone
LanguageHaskell2010

FreeC.IR.TypeScheme

Contents

Description

This module contains functions for converting between type expressions and type schemes.

Synopsis

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.