Top-1.7: Constraint solving framework employed by the Helium Compiler.

Safe HaskellSafe-Infered

Top.Types.Substitution

Contents

Description

This module contains a data type to represent (plain) types, some basic functionality for types, and an instance for Show.

Synopsis

Substitutions and substitutables

nextFTV :: Substitutable a => a -> IntSource

The next type variable that is not free (default is zero)

Substitution instances

type MapSubstitution = Map Int TpSource

A substitution represented by a finite map.

(@@) :: MapSubstitution -> MapSubstitution -> MapSubstitutionSource

Compose two finite map substitutions: safe. Note for union: bindings in right argument shadow those in the left

(@@@) :: MapSubstitution -> MapSubstitution -> MapSubstitutionSource

Compose two finite map substitutions: quick and dirty!

newtype FixpointSubstitution Source

A fixpoint is computed when looking up the target of a type variable in this substitution. Combining two substitutions is cheap, whereas a lookup is more expensive than the normal finite map substitution.

Constructors

FixpointSubstitution (Map Int Tp) 

emptyFPS :: FixpointSubstitutionSource

The empty fixpoint substitution

disjointFPS :: FixpointSubstitution -> FixpointSubstitution -> FixpointSubstitutionSource

Combine two fixpoint substitutions that are disjoint

Wrapper for substitutions

wrapSubstitution :: Substitution substitution => substitution -> WrappedSubstitutionSource

data WrappedSubstitution Source

Constructors

forall a . Substitution a => WrappedSubstitution a (Int -> a -> Tp, [Int] -> a -> a, [Int] -> a -> a, a -> [Int], a -> Tps) 

Substitutables instances