Simon Peyton-Jones simonpj at
Tue Oct 19 10:33:25 EDT 2004

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.

* 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?


More information about the Glasgow-haskell-users mailing list