change to deriving in 6.7 ??

Pepe Iborra mnislaih at gmail.com
Mon Aug 20 18:59:16 EDT 2007


On 20/08/2007, at 23:53, Simon Peyton-Jones wrote:

> Yes, this is a change.  To guarantee that we generate terminating  
> instance declarations, GHC now insists that it can reduce the  
> context of a derived instance to
>
> instance (C a, D b) => …
>
> That is, the context of the instance decl must consist of (class  
> applied to type variables).  Without this constraint it’s all too  
> easy to generate non-terminating instances.
>
>
>
> So the deriving mechanism works in straightforward cases, and for  
> more complicated cases you have to write the instances yourself.
>
>
>
> It’s not impossible that the deriving mechanism could be made a  
> little more liberal, but it errs on the conservative side at the  
> moment.  There’s no workaround - -you just have to write the  
> instance yourself.
>
>
>
> I should document this
>
>
>
> Simon
>

Is being so strict a good idea for the 6.8 release?
This change will break quite a few working code bases. I have seen  
this happen in some code of mine, and in fact believed it was a bug  
in 6.7.

How about restoring the 6.6 liberal behaviour when  
UndecidableInstances is present? Perhaps emiting a warning at the  
same time.

Thanks
pepe


More information about the Cvs-ghc mailing list