Sjoerd Visscher says:
«You might want to point him to multiplate too, that's an exact match with what
he's doing. (I'm not on the jhc mailing list)»
(https://twitter.com/sjoerd_visscher/status/466247707699736576)
* John Meacham
Before
http://repetae.net/drop/TypeSyns_old.hs
and after
http://repetae.net/drop/TypeSyns_new.hs
that's right, the work of a 550 line complicated file done in a few lines.
The magic is in FrontEnd.Syn.Traverse where I have a class that recurses over arbitrary source syntax and takes a
data HsOps m = HsOps { opHsDecl :: HsDecl -> m HsDecl, opHsExp :: HsExp -> m HsExp, opHsPat :: HsPat -> m HsPat, opHsType :: HsType -> m HsType, opHsStmt :: HsStmt -> m HsStmt }
as an argument, by recursively defining your ops by 'tying the knot' each of the routines will recurse down the others. quite handy. Now I have about 2500 lines of code to excise from FrontEnd/.
Many improvements to the front end have been put off due to the sheer amount of traversal code that has to modified for every new syntax construct. good times.
John
-- John Meacham - http://notanumber.net/ _______________________________________________ jhc mailing list jhc@haskell.org http://www.haskell.org/mailman/listinfo/jhc