On Tue, May 13, 2014 at 4:28 AM, Roman Cheplyaka
To be 100% clear, the approach proposed on that page doesn't have this limitation and doesn't conflate structural and logical children. (Sorry if I'm stating the obvious; I am not sure what you're referring to by "those".)
Ah, sorry. I was refering to the 'syb' ones. looks like gtraverse is a better primitive.
I guess you're dealing with an intermediate representation of Haskell code. My motivation behind traverse-with-class is dealing with full Haskell AST as defined in haskell-src-exts. An traversal dictionary for that would be enormous, and most of the components would be the same in any particular traversal (but you don't know in advance which ones, of course).
Actually, the data structure I am traversing and haskell-src are quite related and have a common ancestor. They both branched from the same project a long while ago though, Every now and again I consider merging in the changes, maybe after I get done rewriting the existing code with traversals I will look into it again. It would mean there is a lot less code I'd have to modify if I can just swap out traversal routines.
So traverse-with-class helped me to manage that complexity.
I also had to deal with modifying the traversal; e.g. here's how I propagate scope information in haskell-names:
https://github.com/haskell-suite/haskell-names/blob/master/src/Language/Hask... https://github.com/haskell-suite/haskell-names/blob/master/src/Language/Hask...
Interesting. On the subject of module and haskell name resolution, A major issue for jhc is how haddock just refuses to deal with code it can't handle and barfs, especially on my module/name resolution which allows fully recursive imports without restriction (based on the formal definition given in http://ogi.altocumulus.org/~hallgren/hsmod/Description.pdf ) With the --annotate-src option, jhc can spit out annotated source specifying exactly where each name maps, still trying to figure out how to get that into haddock though but seeing as how bugs with attached fixes get closed like this (http://trac.haskell.org/haddock/ticket/257) I'm not sure how well that will go. Last time I tried to submit a patch that let haddock skip over extensions it didn't recognize it wasn't put in.
It's a small edsl, so it may look weird at first, but it actually worked out pretty nicely.
I do have aversions to implicit parameters in general, I think this is the first time I've seen them in the wild actually. will have to look at what you are doing with them. John -- John Meacham - http://notanumber.net/