newtype deriving, was Re: [Haskell-cafe] is closing a class
simonpj at microsoft.com
Thu Jul 23 08:20:05 EDT 2009
| 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?
Indeed, it's a known problem: http://hackage.haskell.org/trac/ghc/ticket/1496
It's a serious problem too, because it affects type soundness. But I have been moving slowly on fixing it, because I want a proper fix not a hack.
Dimitrios and I have a variety of solutions now, some of which have the flavour of what's suggested below:
| > I wonder if there's a potential refinement of the kind system lurking
| > here, distinguishing *, types-up-to-iso, from |*|, types-up-to-
| > identity.
| > That might help us to detect classes for which newtype deriving is
| > inappropriate: GADTs get indexed over |*|, not *; classes of *s are
| > derivable, but classes of |*|s are not. I certainly don't have a clear
| > proposal just now. It looks like an important distinction: recognizing
| > it somehow might buy us something.
More information about the Haskell-Cafe