[Haskell-cafe] is closing a class this easy?

Stefan Holdermans stefan at cs.uu.nl
Sat Jul 18 04:42:59 EDT 2009


Conor,

> I'm scared. What about this?
>
> data EQ :: * -> * -> * where
>  Refl :: EQ x x
>
> class Public x where
>  blah :: EQ x Fred
>
> instance Public Fred where
>  blah = Refl
>
> What happens when I say
>
> newtype Jim = Hide Fred deriving Public
>
> ? I tried it. I get
>
>  blah :: EQ Jim Fred
>
> It's clear that GeneralizedNewtypeDeriving goes too far.

Now, I am scared. This should be regarded as a bug in generalised  
newtype deriving, shouldn't it? I would expect newtype deriving to be  
unable to come up with instances that cannot be written by hand.

I would have expected people out on the streets marching to GHC  
headquarters by now; how can you stay so calm?

Cheers,

   Stefan


More information about the Haskell-Cafe mailing list