|This module contains a datatype Field and sone type classes. It is used
to construct record-like datatypes.
To create a "record" with the accessors/modificators first you have to define the type
of the record, It must be a right-associative list of pairs, just like a LISP list.
The rightmost element must be () . The following Example defines a record with information
for music generation.
type DefaultNote = (Int, (Double, (Char, ())))
Then a default value should be defined.
defaultNote = (0, (1.0, ('a' , ())))
defaultNote :: DefaultNote
For each "datafield" the Field must be declared.
pitch :: Field DefaultNote Int
volume :: Field DefaultNote Double
channel :: Field DefaultNote Char
Creating the fields is done with toField applied to a value of the "record" type.
pitch :>> volume :>> channel :>> NilM = toFields defaultNote
Is is recommended to declare all types and match all results of toFields incl. the NilM at
pitch :>> volume :>> channel :>> NilM = toFields (undefined :: DefaultNote)
should work too.
|A Field record field is an interface to access a type field which
is part of a type record .
A Field is used to access and modify subtypes ("datafields") of
a record-like datastructure. In this module, a right-associative pair structure is
taken as record-type with "datafields" in the fst parts of the pairs.
|getField :: c -> a|
|setField :: (a -> a) -> c -> c|
|isGroup :: c -> Maybe a|
|mkGroup :: a -> c|
|The correct type is: data NilM (m :: * -> *) = NilM .
(But Haddock rejects this definition. GHC will need it)
data NilM m = NilM
|class PushFields m where||Source|
|class ToFields a r where||Source|
|class PushGroups m where||Source|
|class ToGroups a r where||Source|
|Produced by Haddock version 2.4.2|