[Haskell] Proposal: Allow "\=" for field update in record update
syntax
Benjamin Franksen
benjamin.franksen at bessy.de
Sat Feb 19 18:39:55 EST 2005
Two clarifications:
On Saturday 19 February 2005 22:33, Benjamin Franksen wrote:
> instance RecordField R Label_field1 T1 where
> getField (Rec x _) _ = x
> putField (Rec _ y) _ v = Rec v x
s/Rec/R/
> I wonder if something similar could be done with TH. The labels would need
> to have a different name (e.g. l_field1, l_field2), so they don't collide
> with their Haskell98 definitions, but otherwise everything should be as
> above.
What I mean is: keep the record syntax and everything as it is now, but
additionally use TH in order derive the corresponding first class labels as
indicated above. The question is if a function 'generateLabels' can be
defined with TH. I remember darkly that TH is (or once was) restricted to
Haskell98, and so cannot be used to generate multi parameter class instances.
Ben
More information about the Haskell
mailing list