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

Safe HaskellNone
LanguageHaskell2010

Language.Futhark.TypeChecker.Types

Synopsis

Documentation

unifyTypesU :: (Monoid als, Eq als, ArrayDim dim) => (Uniqueness -> Uniqueness -> Maybe Uniqueness) -> TypeBase dim als -> TypeBase dim als -> Maybe (TypeBase dim als) Source #

unifyTypes uf t2 t2 attempts to unify t1 and t2. If unification cannot happen, Nothing is returned, otherwise a type that combines the aliasing of t1 and t2 is returned. Uniqueness is unified with uf.

subtypeOf :: ArrayDim dim => TypeBase dim as1 -> TypeBase dim as2 -> Bool Source #

x `subtypeOf` y is true if x is a subtype of y (or equal to y), meaning x is valid whenever y is.

subuniqueOf :: Uniqueness -> Uniqueness -> Bool Source #

x subuniqueOf y is true if x is not less unique than y.

checkForDuplicateNames :: MonadTypeChecker m => [UncheckedPattern] -> m () Source #

Check for duplication of names inside a pattern group. Produces a description of all names used in the pattern group.

checkForDuplicateNamesInType :: MonadTypeChecker m => TypeExp Name -> m () Source #

Check whether the type contains arrow types that define the same parameter. These might also exist further down, but that's not really a problem - we mostly do this checking to help the user, since it is likely an error, but it's easy to assign a semantics to it (normal name shadowing).

typeExpUses :: TypeExp VName -> ([VName], [VName]) Source #

Return the shapes used in a given type expression in positive and negative position, respectively.

checkShapeParamUses :: (MonadTypeChecker m, Located a) => (a -> ([VName], [VName])) -> [TypeParam] -> [a] -> m () Source #

Ensure that every shape parameter is used in positive position at least once before being used in negative position.

data TypeSub Source #

Instances
Show TypeSub Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

data Subst t Source #

A type substituion may be a substitution or a yet-unknown substitution (but which is certainly an overloaded primitive type!). The latter is used to remove aliases from types that are yet-unknown but that we know cannot carry aliases (see issue #682).

Constructors

Subst t 
PrimSubst 
Instances
Functor Subst Source # 
Instance details

Defined in Language.Futhark.TypeChecker.Types

Methods

fmap :: (a -> b) -> Subst a -> Subst b #

(<$) :: a -> Subst b -> Subst a #

class Substitutable a where Source #

Class of types which allow for substitution of types with no annotations for type variable names.

Methods

applySubst :: (VName -> Maybe (Subst (TypeBase () ()))) -> a -> a Source #

substTypesAny :: (ArrayDim dim, Monoid as) => (VName -> Maybe (Subst (TypeBase dim as))) -> TypeBase dim as -> TypeBase dim as Source #

Perform substitutions, from type names to types, on a type. Works regardless of what shape and uniqueness information is attached to the type.