Example: 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
the end. NOTE: pitch :>> volume :>> channel :>> NilM = toFields (undefined :: DefaultNote) should work too.
|