Safe Haskell | None |
---|
- class Kind kind where
- class Sort kind sort where
- specialize :: Forall kind piece -> piece sort
- class Kind (K style) => Style style where
- type K style :: *
- type family Value style sort :: *
- class Kind kind => Record kind record where
- build :: thing X -> (forall record name. Record kind record => Forall kind (ExtenderPiece thing record name)) -> thing record
- newtype ExtenderPiece thing record name sort = ExtenderPiece (thing record -> thing (record :& (name ::: sort)))
- data X style = X
- data (record :& field) style = !(record style) :& !(field style)
- data (name ::: sort) style = !name := (Value style sort)
- type family Cat record1 record2 :: * -> *
- cat :: (Style style, Record (K style) record1, Record (K style) record2) => record1 style -> record2 style -> Cat record1 record2 style
- map :: (Style style, Style style', K style ~ K style', Record (K style) record) => Forall (K style) (TransformerPiece style style') -> record style -> record style'
- newtype TransformerPiece style style' sort = TransformerPiece (Value style sort -> Value style' sort)
- class Subrecord subrecord record where
Kinds
class Sort kind sort whereSource
specialize :: Forall kind piece -> piece sortSource
Sort PlainKind val | |
Sort SignalKind (Of signal val) |
Styles
class Kind (K style) => Style style Source
Style PlainStyle | |
Style (ConnectorStyle connector) | |
Style (SignalStyle era) | |
Style style => Style (ContextStyle context style) |
???
Records
class Kind kind => Record kind record whereSource
The class of all record types.
A record type is a type of records without the style parameter. Therefore, it has kind * ->
*
.
build :: thing X -> (forall record name. Record kind record => Forall kind (ExtenderPiece thing record name)) -> thing recordSource
A general method for building record-related “things”.
For each record type, this method constructs a value which is somehow related to this
record type. Such a value is called a thing. The type parameter thing
maps record
types to the types of their corresponding things. The first argument of build
gives
the thing of the empty record type while the second argument tells how to transform a
thing of an arbitrary record type into the thing of this record type extended
with an arbitrary field type.
build
is used, for example, to implement the function cat
.
newtype ExtenderPiece thing record name sort Source
ExtenderPiece (thing record -> thing (record :& (name ::: sort))) |
The type of empty records.
data (record :& field) style Source
The type of non-empty records, consisting of an initial record and a last field.
!(record style) :& !(field style) |
(Kind kind, Record kind record, Sort kind sort) => Record kind (:& record (::: name sort)) | |
OptRecord optRecord => OptRecord (:& optRecord (::: (Opt name) sort)) | |
OptRecord optRecord => OptRecord (:& optRecord (::: (Req name) sort)) | |
(Dissection record remainder subname subsort, Subrecord subrecord remainder) => Subrecord (:& subrecord (::: subname subsort)) record | |
(Show (init style), Show (last style)) => Show (:& init last style) |
data (name ::: sort) style Source
The family of record fields.
Each instance of it matches arbitrary name
parameters and all signalOfVal
parameters
which are of the form signal `
. The actual choice of the instance
depends only on the Of
` valstyle
parameter. The structure of fields of a specific style is
documented together with the respective style type.
(Kind kind, Record kind record, Sort kind sort) => Record kind (:& record (::: name sort)) | |
OptRecord optRecord => OptRecord (:& optRecord (::: (Opt name) sort)) | |
OptRecord optRecord => OptRecord (:& optRecord (::: (Req name) sort)) | |
(Dissection record remainder subname subsort, Subrecord subrecord remainder) => Subrecord (:& subrecord (::: subname subsort)) record | |
(Show name, Show (Value style sort)) => Show (::: name sort style) |
Catenation
cat :: (Style style, Record (K style) record1, Record (K style) record2) => record1 style -> record2 style -> Cat record1 record2 styleSource
The catenation of two records.
Mapping
map :: (Style style, Style style', K style ~ K style', Record (K style) record) => Forall (K style) (TransformerPiece style style') -> record style -> record style'Source
Application of a function to the fields of a record.
newtype TransformerPiece style style' sort Source
TransformerPiece (Value style sort -> Value style' sort) |
Subrecords
class Subrecord subrecord record whereSource
The class of all pairs of record types where the first is a subrecord of the second.
Currenty, the subrecord relation is only defined for records which do not have multiple occurences of the same name. A records is a subrecord of another record if all field types of the first record are also field types of the second, independently of order.
The instance declarations of Subrecord
use several helper classes which are hidden. One of
them is the class Presence
. You get the error message that no instance of Presence
name
could be found if the alleged subrecord contains a name which is not present in the
alleged superrecord.