futhark-0.9.1: An optimising compiler for a functional, array-oriented language.

Safe HaskellNone
LanguageHaskell2010

Language.Futhark.TypeChecker.Unify

Synopsis

Documentation

type Constraints = Map VName Constraint Source #

Mapping from fresh type variables, instantiated from the type schemes of polymorphic functions, to (possibly) specific types as determined on application and the location of that application, or a partial constraint on their type.

data BreadCrumb Source #

A piece of information that describes what process the type checker currently performing. This is used to give better error messages.

Constructors

MatchingTypes (TypeBase () ()) (TypeBase () ()) 
MatchingFields Name 

mkTypeVarName :: String -> Int -> Name Source #

Construct a the name of a new type variable given a base description and a tag number (note that this is distinct from actually constructing a VName; the tag here is intended for human consumption but the machine does not care).

zeroOrderType :: (MonadUnify m, Pretty (ShapeDecl dim), Monoid as) => SrcLoc -> String -> TypeBase dim as -> m () Source #

mustHaveConstr :: MonadUnify m => SrcLoc -> Name -> TypeBase dim as -> m () Source #

mustHaveField :: (MonadUnify m, Monoid as) => SrcLoc -> Name -> TypeBase dim as -> m (TypeBase dim as) Source #

mustBeOneOf :: MonadUnify m => [PrimType] -> SrcLoc -> TypeBase () () -> m () Source #

equalityType :: (MonadUnify m, Pretty (ShapeDecl dim), Monoid as) => SrcLoc -> TypeBase dim as -> m () Source #

unify :: MonadUnify m => SrcLoc -> TypeBase () () -> TypeBase () () -> m () Source #

Unifies two types.

doUnification :: SrcLoc -> [TypeParam] -> TypeBase () () -> TypeBase () () -> Either TypeError (TypeBase () ()) Source #

Perform a unification of two types outside a monadic context. The type parameters are allowed to be instantiated (with 'TypeParamDim ignored); all other types are considered rigid.