
On Tue, 19 Oct 2004 15:33:25 +0100, Simon Peyton-Jones
Thanks to those who responded to this thread about 'deriving'. My current thoughts are:
* I'd be happy to add the ability to separate a 'deriving' clause from its data type declaration, if we can agree syntax (see below). It's fairly easy to do; it makes the language more orthogonal; it's useful.
But in fact I think only Martin Sjögren has explicitly said that the feature would be useful.... and every feature has a cost.
It would be quite useful indeed! The scenarios I have experienced are quite complex, but they occur. Georg
* I'm not at all keen on making '..deriving( Foo )' mean $(derive 'Foo) or something like that. Just make the TH call yourself!
* No one is arguing hard for instance declarations in hi-boot files, so let's leave that for now.
Re syntax, the obvious possibility (A) is to add
derive( pred1, .., predn )
as a new top-level declaration. E.g.
derive( Typeable (T a) )
But that means adding 'derive' as a keyword. Other possibilities: deriving( Typeable (T a) ) -- (B) Re-use 'deriving' keyword
The trouble with (B) is that the thing inside the parens is different in this situation than in a data type declaration.
Any other ideas?
Simon