[Haskell-cafe] Deconstructing types

Sean Leather leather at cs.uu.nl
Tue Sep 8 13:54:19 EDT 2009

> The answer is, I'm working on a recently semi-released package called
> TrieMap.
> The objective of this package, building off of the work in this paper<https://docs.google.com/Doc?docid=0AWuaUF8ZNTNDZHB3emdyaF8zMzNmZmtmcHo2Yw&hl=en>,
> is to automatically derive the type of a generalized trie for any algebraic
> type based on its algebraic representation.  (I am working on writing up my
> methods for publication.)
> Of course, if I could get automatic access to the mechanisms of a type's
> constructors, I wouldn't even require users to describe the algebraic
> representation of their type...

Well, it's relatively easy to use Template Haskell to determine the
structure of a datatype. Look in the "Generics" category on Hackage for a
number of examples (e.g. emgm, regular, multirec) or see if the Derive
package will do it for you. According to Neil Mitchell, you just need one


I don't know if it's easy or even possible to capture a sum-of-products view
from SYB.

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

More information about the Haskell-Cafe mailing list