ddc-core-0.2.1.1: Disciple Core language and type checker.

Safe HaskellSafe-Infered

DDC.Core.DataDef

Contents

Description

Algebraic data type definitions.

Synopsis

Documentation

data DataDef n Source

The definition of a single data type.

Constructors

DataDef 

Fields

dataDefTypeName :: n

Name of the data type.

dataDefParamKinds :: [Kind n]

Kinds of type parameters.

dataDefCtors :: Maybe [(n, [Type n])]

Constructors of the data type, or Nothing if there are too many to list (like with Int).

Data type definition table

data DataDefs n Source

A table of data type definitions, unpacked into type and data constructors so we can find them easily.

Constructors

DataDefs 

Fields

dataDefsTypes :: Map n (DataType n)
 
dataDefsCtors :: Map n (DataCtor n)
 

data DataMode n Source

The mode of a data type records how many data constructors there are. This can be set to Large for large primitive types like Int and Float. In this case we don't ever expect them all to be enumerated as case alternatives.

Constructors

DataModeSmall [n] 
DataModeLarge 

data DataType n Source

Describes a data type constructor, used in the DataDefs table.

Constructors

DataType 

Fields

dataTypeName :: n

Name of data type constructor.

dataTypeParamKinds :: [Kind n]

Kinds of type parameters to constructor.

dataTypeMode :: DataMode n

Names of data constructors of this data type, or Nothing if it has infinitely many constructors.

data DataCtor n Source

Describes a data constructor, used in the DataDefs table.

Constructors

DataCtor 

Fields

dataCtorName :: n

Name of data constructor.

dataCtorFieldTypes :: [Type n]

Field types of constructor.

dataCtorTypeName :: n

Name of result type of constructor.

emptyDataDefs :: DataDefs nSource

An empty table of data type definitions.

insertDataDef :: Ord n => DataDef n -> DataDefs n -> DataDefs nSource

Insert a data type definition into some DataDefs.

fromListDataDefs :: Ord n => [DataDef n] -> DataDefs nSource

Build a DataDefs table from a list of DataDef

lookupModeOfDataType :: Ord n => n -> DataDefs n -> Maybe (DataMode n)Source

Yield the list of data constructor names for some data type, or Nothing for large types with too many constructors to list.