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

Safe HaskellSafe
LanguageHaskell98

DDC.Type.Sum

Contents

Description

Utilities for working with TypeSums.

Synopsis

Constructors

empty :: Kind n -> TypeSum n Source #

Construct an empty type sum of the given kind.

singleton :: Ord n => Kind n -> Type n -> TypeSum n Source #

Construct a type sum containing a single element.

union :: Ord n => TypeSum n -> TypeSum n -> TypeSum n Source #

Add two type sums.

unions :: Ord n => Kind n -> [TypeSum n] -> TypeSum n Source #

Union a list of TypeSums together.

insert :: Ord n => Type n -> TypeSum n -> TypeSum n Source #

Insert a new element into a sum.

Conversion

toList :: TypeSum n -> [Type n] Source #

Flatten out a sum, yielding a list of individual terms.

fromList :: Ord n => Kind n -> [Type n] -> TypeSum n Source #

Convert a list of types to a TypeSum

Projection

kindOfSum :: TypeSum n -> Kind n Source #

Take the kind of a sum.

elem :: (Eq n, Ord n) => Type n -> TypeSum n -> Bool Source #

Check whether an element is a member of a sum.

  • Returns True when the first argument is $0 or !0.
  • Returns False when the first argument is another sum.
  • May return False if the first argument is miskinded but still alpha-equivalent to some component of the sum.

Deletion

delete :: Ord n => Type n -> TypeSum n -> TypeSum n Source #

Delete an element from a sum.

difference :: Ord n => TypeSum n -> TypeSum n -> TypeSum n Source #

Delete all members of the second sum from the first one.

Hashing

hashTyCon :: TyCon n -> Maybe TyConHash Source #

Yield the TyConHash of a TyCon, or Nothing if there isn't one.

hashTyConRange :: (TyConHash, TyConHash) Source #

The range of hashes that can be produced by hashTyCon.

unhashTyCon :: TyConHash -> TyCon n Source #

Yield the TyCon corresponding to a TyConHash, or error if there isn't one.

Orphan instances

Eq n => Eq (TyCon n) Source # 

Methods

(==) :: TyCon n -> TyCon n -> Bool #

(/=) :: TyCon n -> TyCon n -> Bool #

Eq n => Eq (TypeSumVarCon n) Source # 
Eq n => Eq (TypeSum n) Source # 

Methods

(==) :: TypeSum n -> TypeSum n -> Bool #

(/=) :: TypeSum n -> TypeSum n -> Bool #

Eq n => Eq (Type n) Source # 

Methods

(==) :: Type n -> Type n -> Bool #

(/=) :: Type n -> Type n -> Bool #

Eq n => Eq (Bound n) Source # 

Methods

(==) :: Bound n -> Bound n -> Bool #

(/=) :: Bound n -> Bound n -> Bool #

Eq n => Eq (Bind n) Source # 

Methods

(==) :: Bind n -> Bind n -> Bool #

(/=) :: Bind n -> Bind n -> Bool #

Ord n => Ord (TypeSumVarCon n) Source # 
Ord n => Ord (Bound n) Source # 

Methods

compare :: Bound n -> Bound n -> Ordering #

(<) :: Bound n -> Bound n -> Bool #

(<=) :: Bound n -> Bound n -> Bool #

(>) :: Bound n -> Bound n -> Bool #

(>=) :: Bound n -> Bound n -> Bool #

max :: Bound n -> Bound n -> Bound n #

min :: Bound n -> Bound n -> Bound n #