[Haskell-cafe] Wouter Swierstra style extensible records!

Ron Alford ronwalf at volus.net
Thu Jul 3 23:42:56 EDT 2008

Having made over-use of Wouter's expression idioms, I decided to hack
it into extensible records.
It's not documented, it's probably got holes in its usability, but I
thought I'd post it so people can play with it (and give suggestions
before I rewrite my code to use it!).

I know there are other extensible record systems, but I wondered how
this stacks up.  Notably, it looks like in HList the records are only
extensible in one direction (tacking fields onto the end), although
they have a much more developed syntax (if you're into that sort of

Current problems:
* Defining a new field is rather bulky - currently it takes lines.
Definitions are bulky in Wouter's extensible expressions, too, but I
could probably shorten the get/set convenience functions to something
more readable.
* Construction of new records is only convenient by using the
defaulting system.  Maybe that makes sense, maybe it doesn't.

A side benefit:
Record access functions are reusable between record types (as long as
they have the same type).

Anyway, thanks again, Wouter!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: WouterRecords.hs
Type: application/octet-stream
Size: 2591 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080703/0d46ad57/WouterRecords.obj

More information about the Haskell-Cafe mailing list