Hi,

Well, I do have a preprocessor tool called derive, but it doesn't
currently what I gather Olaf requires, (although this sounds like
another useful application for it, and wouldn't be too hard to add)

What 'derive' does do is allow the derivation of classes which aren't
usually supported by the ghc/hugs/hbc/whatever compilers.

Briefly, what it does is :-
* parses an input file, looking for data and newtype declarations
* looks for an annotation at the end of a data/newtype declr. telling
it   what code to produce from this.
* generates haskell code from the parsed data declr. 
* appends code to the bottom of the file

Code is generated by applying rules to the parsed representation of the
data declaration. (a sort of un-parser, if you like :-) )

'derive' is a haskell 1.4 script, with the intention that the user adds
whatever rules he requires to it (the rules being standard haskell)

For instance, the Parallel Haskell research here in Glasgow, has a
parallelism method based up[on 'strategies' which require producing
instances of a class which reduces to normal form (called NFData).  The
rules to generate these instances are quite simple to code, just apply
`seq` to all the elements of the datatype recursively.  Going through
existing code, adding these intances by hand is quite tiresome, which
inspired me to write 'derive'.  

Now, the bad news - 'derive' isn't really up for releasing yet.  there's
a few bugs in the parser, little documentation, and I would also like to
alter the output mechanism, so that it uses pretty printing combinators.
I'm busy writing a paper at the mo', but intend to properly finish and
relase 'derive' after this (within the next month) 


-- 
Noel Winstanley
Dept of Computing Science   
University of Glasgow            
http://www.dcs.gla.ac.uk/~nww/



Reply via email to