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

Safe HaskellSafe-Inferred

DDC.Core.DaCon

Synopsis

Documentation

data DaCon n Source

Data constructors.

Constructors

DaCon 

Fields

daConName :: !(DaConName n)

Name of the data constructor.

daConType :: !(Type n)

Type of the data constructor. The type must be closed.

daConIsAlgebraic :: !Bool

Algebraic constructors can be deconstructed with case-expressions, and must have a data type declaration.

Non-algebraic types like Float can't be inspected with case-expressions.

Instances

SpreadX DaCon 
Eq n => Eq (DaCon n) 
Show n => Show (DaCon n) 
(Pretty n, Eq n) => Pretty (DaCon n) 
NFData n => NFData (DaCon n) 

data DaConName n Source

Data constructor names.

Constructors

DaConUnit

The unit data constructor is builtin.

DaConNamed n

Data constructor name defined by the client.

Instances

Eq n => Eq (DaConName n) 
Show n => Show (DaConName n) 
NFData n => NFData (DaConName n) 

dcUnit :: DaCon nSource

The unit data constructor.

mkDaConAlg :: n -> Type n -> DaCon nSource

Make an algebraic data constructor.

mkDaConSolid :: n -> Type n -> DaCon nSource

Make a non-algebraic (solid) constructor. These are used for location values in the interpreter, and for floating point literals in the main compiler.

takeNameOfDaCon :: DaCon n -> Maybe nSource

Take the name of data constructor.

typeOfDaCon :: DaCon n -> Type nSource

Take the type annotation of a data constructor.