ddc-source-tetra-0.4.3.1: Disciplined Disciple Compiler source language.

Safe HaskellNone
LanguageHaskell98

DDC.Source.Tetra.Env

Contents

Description

Source Tetra primitive type and kind environments.

Synopsis

Documentation

data Env Source #

Constructors

Env 

Fields

data Presence a Source #

Presence of a variable in the environment.

Constructors

Absent

Variable is not present in environment.

Unknown

Variable is present but we don't have a type for it.

Present a

Variable is present in the environment with this information.

Instances

Show a => Show (Presence a) Source # 

Methods

showsPrec :: Int -> Presence a -> ShowS #

show :: Presence a -> String #

showList :: [Presence a] -> ShowS #

takePresent :: Presence a -> Maybe a Source #

Yield Just for a Present and Nothing for the others.

empty :: Env Source #

An empty environment.

union :: Env -> Env -> Env Source #

Take the right biased union of two environments.

unions :: [Env] -> Env Source #

Take the right biased union of a list of type environments.

Type Variables

singletonTyVar :: Bind -> Type -> Env Source #

Yield an environment containing the kind for a single type variable.

singletonTyVar' :: Bind -> Env Source #

Yield an environment containing a single type variable.

extendTyVar :: Bind -> Type -> Env -> Env Source #

Extend the environment with the kind for a type variable.

extendTyVar' :: Bind -> Env -> Env Source #

Extend the environment with a type variable where we don't know its kind.

extendsTyVar' :: [Bind] -> Env -> Env Source #

Extend the environment with some type variables where we don't know their kinds.

lookupTyVar :: Env -> Bound -> Presence Type Source #

Lookup the kind of the given type variable.

tyStackDepth :: Env -> Int Source #

Get the depth of the type stack.

Data Constructors

singletonDaCon :: DaConBind -> Type -> Env Source #

Yield an environment containing the type of a single data constructor.

extendDaCon :: DaConBind -> Type -> Env -> Env Source #

Extend the environment with the type of a data constructor.

lookupDaCon :: DaConBound -> Env -> Maybe Type Source #

Lookup the type of a data constructor.

Term Variables

singletonDaVar :: Bind -> Type -> Env Source #

Yield an environment containing the type for a single term variable.

singletonDaVar' :: Bind -> Env Source #

Yield an environment containing a single term variable where we don't know its type.

extendDaVar :: Bind -> Type -> Env -> Env Source #

Extend the environment with the type of a term variable.

extendsDaVar :: [(Bind, Type)] -> Env -> Env Source #

Extend the environment with the types of some term variables.

extendDaVar' :: Bind -> Env -> Env Source #

Extend the environment with a term variable where we don't know it's type.

extendsDaVarMT :: [BindVarMT] -> Env -> Env Source #

Like extendDaVarMT but take a list of BindVarMT

lookupDaVar :: Env -> Bound -> Presence Type Source #

Lookup the kind of the given type variable.

daStackDepth :: Env -> Int Source #

Get the depth of the type stack.

Primitive Kinds and Types.

kindOfPrimType :: PrimType -> Maybe Type Source #

Take the kind of a primitive type.

typeOfPrimVal :: PrimVal -> Type Source #

Take the type of a primitive name.

typeOfPrimLit :: PrimLit -> Type Source #

Take the type of a primitive literal.