- generaliseGroup :: [Name] -> [TypeCheckMonad [(Name, Type)]] -> TypeCheckMonad [[(Name, TypeScheme)]]
- instantiate :: TypeScheme -> TypeCheckMonad Type
- unify :: Type -> Type -> TypeCheckMonad Type
- unifyAll :: [Type] -> TypeCheckMonad Type
- evaluateDots :: Type -> TypeCheckMonad Type
- typeToDotList :: Type -> TypeCheckMonad [Type]
- dotableToDotList :: Type -> TypeCheckMonad ([Type], Type)
- substituteTypes :: [(TypeVar, Type)] -> Type -> TypeCheckMonad Type
- instantiate' :: TypeScheme -> TypeCheckMonad (Type, [(TypeVar, Type)])
Generalise the types of the declarations. The parameter
names gives the
names that were bound by all the declarations that we are interested in. This
is done because we convert a type T into forall vs T where
vs = fvts (T) - fvts(Env)
where Env does not contain the function whose type we are generalizing
(this is because when we type a declaration we are really typing a
Instantiates the typescheme with some fresh type variables.
The main type unification algorithm. This adds values to the unification stack in order to ensure error messages are helpful.
Unifys all types to a single type. The first type is used as the expected Type in error messages.
Takes a type and attempts to simplify all TDots inside by combining TDotable t1 t2 and arguments.
Takes a type and converts TDot t1 t2 to [t1, t2].