[jhc] The Wonders of generic applicative traversal routines

John Meacham john at repetae.net
Tue May 13 10:21:51 UTC 2014


Yeah, I have used those before, and still use Data.Data generics in jhc in
some places but always found them unwieldy. As you note in your page, .exact
structural children and logical children of a type may be different and
I found them brittle when I modified a type, I ended up not being able to
use standard types like [] and Maybe as much because I occasionally wanted
to do more interesting things with traversal.

This hybrid explicit dictionary approach that applies the traversal to
components in parallel seems to be a sweet spot. I attempted something like
it before using typeclasses, but it didn't work because I needed to modify
the traversal functions en route sometimes based on dynamic info so anything
hardcoded at the type level, even with clever newtype deriving, I found
lacking.

    John

--
John Meacham - http://notanumber.net/


More information about the jhc mailing list