Safe Haskell | None |
---|---|
Language | Haskell98 |
This module provides records of signals and signal-related data.
A record has a type of the following form:
(X :& name_1 ::: signal_1 `Of
` val_1 :& ... :& name_n ::: signal_n `Of
` val_n) style
A value of such a type is a list of fields where the ith field has type (name_i :::
signal_i `
.Of
` val_i) style
(:::)
is a data family. Its style
parameter is a phantom type which selects the instance
of the family. For a concrete style
type, the type (name ::: signal `
covers name-value pairs where the type of the values depends on Of
`
val) stylesignal
and
val
. For example, if style
is of the form
, the values have type
SignalStyle
erasignal era val
. This leads to records of signals with identical era. With the styles
and Connector
Consumer
, it is possible to form records of
consumers and producers.Connector
Producer
Field names are represented by types which are declared as follows:
data Name = Name
This makes it possible to use names as types (allowing the use of names in compile-time checks) but also as expressions and patterns.
- data SignalKind
- type SignalRecord era record = record (SignalStyle era)
- data SignalStyle era
- type ConsumerRecord record = ConnectorRecord Consumer record
- type ProducerRecord record = ConnectorRecord Producer record
- type ConnectorRecord connector record = record (ConnectorStyle connector)
- data ConnectorStyle connector
- consume :: Record SignalKind record => ConsumerRecord record -> Circuit era (SignalRecord era record) ()
- produce :: Record SignalKind record => ProducerRecord record -> Circuit era () (SignalRecord era record)
Signal kind
data SignalKind Source #
Kind SignalKind Source # | |
Sort SignalKind (Of signal val) Source # | |
data Forall SignalKind Source # | |
Signal records
type SignalRecord era record = record (SignalStyle era) Source #
Records which contain signals of a common era as values.
data SignalStyle era Source #
The style of signal records of a specific era.
Fields of signal style records have the form name ::= signal
.
Style (SignalStyle era) Source # | |
type K (SignalStyle era) Source # | |
type Value (SignalStyle era) (Of signal val) Source # | |
Connector records
type ConsumerRecord record = ConnectorRecord Consumer record Source #
Records which contain signal consumers as values.
type ProducerRecord record = ConnectorRecord Producer record Source #
Records which contain signal producers as values.
type ConnectorRecord connector record = record (ConnectorStyle connector) Source #
Records which which contain signal connectors (producers or consumers) as values.
data ConnectorStyle connector Source #
The consumer and producer record styles.
ConnectorStyle
is the style of consumer records and Consumer
ConnectorStyle
is the style of producer records. Fields of connector style records have the form Producer
name
::~ connector
.
Style (ConnectorStyle connector) Source # | |
type K (ConnectorStyle connector) Source # | |
type Value (ConnectorStyle connector) (Of signal val) Source # | |
consume :: Record SignalKind record => ConsumerRecord record -> Circuit era (SignalRecord era record) () Source #
Converts a record of consumers into a circuit that consumes a corresponding record of signals.
produce :: Record SignalKind record => ProducerRecord record -> Circuit era () (SignalRecord era record) Source #
Converts a record of producers into a circuit that produces a corresponding record of signals.