[Haskell-cafe] Generic traversals for GADTs
ozgurakgun at gmail.com
Sun Oct 31 17:39:59 EDT 2010
SYB-style libraries (and especially Uniplate) make it very easy to run
traversals (queries/transformations) on ADTs.
> data Expr = ...
> x :: Expr
> f :: Expr -> Expr
> transform :: (Expr -> Expr) -> Expr -> Expr
> transform f x :: Expr -- applies f to x (and its children) in a bottom-up
Uniplate is very powerful and doesn't require any hand written type-class
instances to get going reasonably efficiently.
I can simply re-implement the functionality of Uniplate myself, modulo
requiring hand-written instances. (I didn't want to go into that road, since
don't need it for this argument.)
I did this exercise, because I wanted to understand why we don't have
generic traversal libraries for GADTs. And, it didn't take long :)
I can post my trials but they are really baby steps and they wouldn't be
My question is:
Considering how useful generic traversal libraries and GADTs are, has
tried implementing a generic traversal library (like Uniplate or similar)
GADTs? Is it a hard (or impossible, or not efficient, or problematic in some
other way) thing to implement, or is it just not a requirement for anyone
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe