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

DDC.Source.Tetra.Env

Description

Source Tetra primitive type and kind environments.

Synopsis

# Documentation

data Env Source #

Constructors

 Env FieldsenvTyCon :: Map Text TypeMap names of type constructors to their kinds.envTyVar :: Map Text (Maybe Type)Map names of variables to their kinds.envTyStack :: Seq (Maybe Type)Stack of kinds of deBruijn indexed type variables.envDaCon :: Map Text TypeMap names of data constructors to their types.envDaVar :: Map Text (Maybe Type)Map names of term variables to their types.envDaStack :: Seq (Maybe Type)Stack of types of deBruijn indexed term variables.

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 # MethodsshowsPrec :: Int -> Presence a -> ShowS #show :: Presence a -> String #showList :: [Presence a] -> ShowS #

Yield Just for a Present and Nothing for the others.

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

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

Yield an environment containing a single type variable.

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

Extend the environment with the kind for a type variable.

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.

Lookup the kind of the given type variable.

Get the depth of the type stack.

## Data Constructors

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

Extend the environment with the type of a data constructor.

Lookup the type of a data constructor.

## Term Variables

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

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.

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

Like extendDaVar but take a BindVarMT

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

Like extendDaVarMT but take a list of BindVarMT

Lookup the kind of the given type variable.

Get the depth of the type stack.

# Primitive Kinds and Types.

Take the kind of a primitive type.

Take the type of a primitive name.

Take the type of a primitive literal.