[Haskell-cafe] Generics for constructing Rows

Sean Leather leather at cs.uu.nl
Thu Aug 20 12:45:54 EDT 2009

> That seems to be GP problem, as your solution doesn't scale well when I
> wan't to add/remove/change fields in the `Row` record.

Ah yes, this is a good use case. I wasn't paying close enough attention
before, and I didn't see an immediate implementation of your function at the

> The perfect way
> as I see it, would be just editing `Row` data declaration, nothing else.
> Studying few papers about GP in Haskell, I reckon this could be
> represented as generic traversal, using my `Row` declaration with
> `Either`.  I don't see really good way to write a generic producer from
> `[String]` to version of `Row` without `Either`.  But SYB doesn't
> provide a way for passing type-class-parametric functions to gmapT, and
> SYB-with-class has large overhead of its usage.  I don't have enough
> time to find out how this can be written in SYB-with-class, if it really
> can be
> written.  The restriction of EMGM was described in my initial message.

I would suggest looking at Multirec. There's a draft of the paper to be
published at ICFP, and the library is on Hackage.


If you don't have anything generically useful by next week, I'll look at it
again when I have more time.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20090820/da3480ee/attachment.html

More information about the Haskell-Cafe mailing list