[Haskell] Proposal: Allow "\=" for field update in record update syntax

Benjamin Franksen benjamin.franksen at bessy.de
Wed Feb 23 17:14:51 EST 2005

On Sunday 20 February 2005 10:16, Daan Leijen wrote:
> Benjamin Franksen wrote:
> > This library class defines the operations on a record:
> >
> >	class RecordField r l t | r l -> t where
> >	  getField :: l -> r -> t
> >	  putField :: l -> t -> r -> r
> I have once written a short note about how Haskell'98 records could
> be made more useful using a conservative extensions. The suggested
> implementation method corresponds quite closely to what you sketch
> here. Here is the url:
> <http://www.cs.uu.nl/~daan/download/papers/records.pdf>
> It should be interesting to read about the different tradeoffs of
> extending the current record system, but keep in mind that this is a
> just a quick writeup of ideas (and written two years ago!)

Yes, quite interesting, indeed.

"My" sketch (I don't claim any originality) differs from yours mostly in that 
mine has one additional argument, namely the label type, which results in 
labels becoming first class values. I really like first class record labels!

You mentioned that higher-ranked types are not allowed in instance 
declarations and that this limits the usefulness of your translation. This is 
unfortunate and applies to my translation too. From what I read elsewhere, I 
guess the standard workaround is to wrap such types in a newtype. The problem 
is that this newtype wrapping and unwrapping cannot be made transparent (at 
least I don't see a way to do this).

Keean, how do you solve this problem in your TH code?


More information about the Haskell mailing list