Proposal for stand-alone deriving declarations?

Ross Paterson ross at soi.city.ac.uk
Sat Oct 7 09:46:51 EDT 2006


On Thu, Oct 05, 2006 at 10:05:20AM +0200, Bjorn Bringert wrote:
> I propose to add a top-level declaration on the form:
> 
> 'deriving' qtycls 'for' qtycon
> 
> which produces the same instance as a deriving clause in the  
> declaration of the datatype or newtype would.

If this is added (whatever the syntax), you'd also want to permit multiple
identical derived instances.

The main use for this seems to be when a module defining a data type
lacks an instance you want, and for some reason you can't get the
original module changed.  (It could also be used to derive instances of
a class you just defined for existing newtypes, but that seems rarer.)
Several modules might use this workaround for the same base module,
and you wouldn't want those modules to be incompatible.



More information about the Haskell-prime mailing list