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

Safe HaskellSafe
LanguageHaskell98

DDC.Type.Exp.Generic.Compounds

Contents

Synopsis

Destructors

takeTCon :: GType l -> Maybe (GTyCon l) Source #

Take a type constructor, looking through annotations.

takeTVar :: GType l -> Maybe (GTBoundVar l) Source #

Take a type variable, looking through annotations.

takeTAbs :: GType l -> Maybe (GTBindVar l, GType l, GType l) Source #

Take a type abstraction, looking through annotations.

takeTApp :: GType l -> Maybe (GType l, GType l) Source #

Take a type application, looking through annotations.

Type Applications

makeTApps :: GType l -> [GType l] -> GType l Source #

Construct a sequence of type applications.

takeTApps :: GType l -> [GType l] Source #

Flatten a sequence of type applications into the function part and arguments, if any.

Function Types

makeTFun :: GType l -> GType l -> GType l infixr 9 Source #

Construct a function type with the given parameter and result type.

makeTFuns :: [GType l] -> GType l -> GType l Source #

Like makeFun but taking a list of parameter types.

makeTFuns' :: [GType l] -> Maybe (GType l) Source #

Like makeTFuns but taking the parameter and return types as a list.

(~>) :: GType l -> GType l -> GType l infixr 9 Source #

takeTFun :: GType l -> Maybe (GType l, GType l) Source #

Destruct a function type into its parameter and result types, returning Nothing if this isn't a function type.

takeTFuns :: GType l -> ([GType l], GType l) Source #

Destruct a function type into into all its parameters and result type, returning an empty parameter list if this isn't a function type.

takeTFuns' :: GType l -> [GType l] Source #

Like takeFuns, but yield the parameter and return types in the same list.

Forall Types

makeTForall :: Anon l => l -> GType l -> (GType l -> GType l) -> GType l Source #

Construct a forall quantified type using an anonymous binder.

makeTForalls :: Anon l => l -> [GType l] -> ([GType l] -> GType l) -> GType l Source #

Construct a forall quantified type using some anonymous binders.

takeTForall :: GType l -> Maybe (GType l, GTBindVar l, GType l) Source #

Destruct a forall quantified type, if this is one.

The kind we return comes from the abstraction rather than the Forall constructor.

Exists Types

makeTExists :: Anon l => l -> GType l -> (GType l -> GType l) -> GType l Source #

Construct an exists quantified type using an anonymous binder.

takeTExists :: GType l -> Maybe (GType l, GTBindVar l, GType l) Source #

Destruct an exists quantified type, if this is one.

The kind we return comes from the abstraction rather than the Exists constructor.

Union types

takeTUnion :: GType l -> Maybe (GType l, GType l, GType l) Source #

Take the kind, left and right types from a union type.

makeTUnions :: GType l -> [GType l] -> GType l Source #

Make a union type from a kind and list of component types.

takeTUnions :: Eq (GType l) => GType l -> Maybe (GType l, [GType l]) Source #

Split a union type into its components. If this is not a union, or is an ill kinded union then Nothing.

splitTUnionsOfKind :: Eq (GType l) => GType l -> GType l -> Maybe [GType l] Source #

Split a union of the given kind into its components. When we split a sum we need to check that the kind attached to the sum type constructor is the one that we were expecting, otherwise we risk splitting ill-kinded sums without noticing it.