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
thing).

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!

-Ron

Attachment: WouterRecords.hs
Description: Binary data

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to