ddc-core-0.4.1.3: Disciplined Disciple Compiler core language and type checker.

Safe HaskellSafe-Inferred

DDC.Type.Predicates

Contents

Description

Predicates on type expressions.

Synopsis

Binders

isBNone :: Bind n -> BoolSource

isBAnon :: Bind n -> BoolSource

isBName :: Bind n -> BoolSource

Atoms

isTVar :: Type n -> BoolSource

Check whether a type is a TVar

isBot :: Type n -> BoolSource

Test if some type is an empty TSum

isAtomT :: Type n -> BoolSource

Check whether a type is a TVar, TCon or is Bottom.

isTExists :: Type n -> BoolSource

Check whether this type is an existential variable.

Kinds

isDataKind :: Kind n -> BoolSource

Check if some kind is the data kind.

isRegionKind :: Region n -> BoolSource

Check if some kind is the region kind.

isEffectKind :: Kind n -> BoolSource

Check if some kind is the effect kind.

isClosureKind :: Kind n -> BoolSource

Check if some kind is the closure kind.

isWitnessKind :: Kind n -> BoolSource

Check if some kind is the witness kind.

Data Types

isAlgDataType :: Eq n => Type n -> BoolSource

Check whether this type is that of algebraic data.

It needs to have an explicit data constructor out the front, and not a type variable. The constructor must not be the function constructor, and must return a value of kind *.

isWitnessType :: Eq n => Type n -> BoolSource

Check whether type is a witness constructor

isConstWitType :: Eq n => Type n -> BoolSource

Check whether this is the type of a Const witness.

isMutableWitType :: Eq n => Type n -> BoolSource

Check whether this is the type of a Mutable witness.

isDistinctWitType :: Eq n => Type n -> BoolSource

Check whether this is the type of a Distinct witness.

Effect Types

isReadEffect :: Effect n -> BoolSource

Check whether this is an atomic read effect.

isWriteEffect :: Effect n -> BoolSource

Check whether this is an atomic write effect.

isAllocEffect :: Effect n -> BoolSource

Check whether this is an atomic alloc effect.

isSomeReadEffect :: Effect n -> BoolSource

Check whether an effect is some sort of read effect. Matches Read HeadRead and DeepRead.

isSomeWriteEffect :: Effect n -> BoolSource

Check whether an effect is some sort of allocation effect. Matches Alloc and DeepAlloc

isSomeAllocEffect :: Effect n -> BoolSource

Check whether an effect is some sort of allocation effect. Matches Alloc and DeepAlloc