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

Safe HaskellSafe
LanguageHaskell98

DDC.Core.Exp.Simple.Exp

Contents

Description

Core language AST with a separate node to hold annotations.

This version of the AST is used when generating code where most or all of the annotations would be empty. General purpose transformations should deal with the fully annotated version of the AST instead.

Synopsis

Documentation

Expressions

data Exp a n Source

Well-typed expressions have types of kind Data.

Constructors

XAnnot a (Exp a n)

Annotation.

XVar !(Bound n)

Value variable or primitive operation.

XCon !(DaCon n)

Data constructor or literal.

XLAM !(Bind n) !(Exp a n)

Type abstraction (level-1).

XLam !(Bind n) !(Exp a n)

Value and Witness abstraction (level-0).

XApp !(Exp a n) !(Exp a n)

Application.

XLet !(Lets a n) !(Exp a n)

Possibly recursive bindings.

XCase !(Exp a n) ![Alt a n]

Case branching.

XCast !(Cast a n) !(Exp a n)

Type cast.

XType !(Type n)

Type can appear as the argument of an application.

XWitness !(Witness a n)

Witness can appear as the argument of an application.

Instances

Annotate Exp Exp Source 
Deannotate Exp Exp Source 
(Eq a, Eq n) => Eq (Exp a n) Source 
(Show a, Show n) => Show (Exp a n) Source 
(NFData a, NFData n) => NFData (Exp a n) Source 

data Cast a n Source

Type casts.

Constructors

CastWeakenEffect !(Effect n)

Weaken the effect of an expression. The given effect is added to the effect of the body.

CastPurify !(Witness a n)

Purify the effect (action) of an expression.

CastBox

Box up a computation, capturing its effects in the S computation type.

CastRun

Run a computation, releasing its effects into the environment.

Instances

Annotate Cast Cast Source 
Deannotate Cast Cast Source 
(Eq a, Eq n) => Eq (Cast a n) Source 
(Show a, Show n) => Show (Cast a n) Source 
(NFData a, NFData n) => NFData (Cast a n) Source 

data Lets a n Source

Possibly recursive bindings.

Constructors

LLet !(Bind n) !(Exp a n)

Non-recursive expression binding.

LRec ![(Bind n, Exp a n)]

Recursive binding of lambda abstractions.

LPrivate ![Bind n] !(Maybe (Type n)) ![Bind n]

Bind a local region variable, and witnesses to its properties.

Instances

Annotate Lets Lets Source 
Deannotate Lets Lets Source 
(Eq a, Eq n) => Eq (Lets a n) Source 
(Show a, Show n) => Show (Lets a n) Source 
(NFData a, NFData n) => NFData (Lets a n) Source 

data Alt a n Source

Case alternatives.

Constructors

AAlt !(Pat n) !(Exp a n) 

Instances

Annotate Alt Alt Source 
Deannotate Alt Alt Source 
(Eq a, Eq n) => Eq (Alt a n) Source 
(Show a, Show n) => Show (Alt a n) Source 
(NFData a, NFData n) => NFData (Alt a n) Source 

data Pat n Source

Pattern matching.

Constructors

PDefault

The default pattern always succeeds.

PData !(DaCon n) ![Bind n]

Match a data constructor and bind its arguments.

Instances

Eq n => Eq (Pat n) Source 
Show n => Show (Pat n) Source 
NFData n => NFData (Pat n) Source 

Witnesses

data Witness a n Source

When a witness exists in the program it guarantees that a certain property of the program is true.

Constructors

WAnnot a (Witness a n) 
WVar !(Bound n)

Witness variable.

WCon !(WiCon n)

Witness constructor.

WApp !(Witness a n) !(Witness a n)

Witness application.

WType !(Type n)

Type can appear as the argument of an application.

Data Constructors

data DaCon n Source

Data constructors.

Constructors

DaConUnit

Baked in unit data constructor.

DaConPrim

Primitive data constructor used for literals and baked-in constructors.

The type of the constructor needs to be attached to handle the case where there are too many constructors in the data type to list, like for Int literals. In this case we determine what data type it belongs to from the attached type of the data constructor.

Fields

daConName :: !n

Name of the data constructor.

daConType :: !(Type n)

Type of the data constructor.

DaConBound

Data constructor that has a data type declaration.

Fields

daConName :: !n

Name of the data constructor.

Instances

Witness Constructors

data WiCon n Source

Witness constructors.

Constructors

WiConBound !(Bound n) !(Type n)

Witness constructors defined in the environment. In the interpreter we use this to hold runtime capabilities. The attached type must be closed.

Instances