On Fri, 14 Nov 2003 15:12:41 +1100
Sean Seefried
I could see this task being repeated over and over again, so I did what any good programmer would do and wrote a module to relieve the burden of writing the recursive cases, which I have called THTraverse.
I'm sure plenty have seen it. I was going to handle this with updateable fold algebras as well as get TH to generate them*, but the GHC "Scrap Your Boilerplate" support seemed to take away much of the motivation. It seems a much quicker way to 'do' THTraverse is simply to add deriving (Data,Typeable) to the TH data types or, less mutatively, to have a module with the instances. I think this has been mentioned before, though I may be thinking of somewhere else. At any rate, I've thought about it before. * I actually have a handwritten one for datatypes.