Improve newtype deriving
authorsimonpj@microsoft.com <unknown>
Sun, 2 Apr 2006 21:59:11 +0000 (21:59 +0000)
committersimonpj@microsoft.com <unknown>
Sun, 2 Apr 2006 21:59:11 +0000 (21:59 +0000)
commitaa2c486e51caa0386aaff0d1b866a60316500b41
treefd21f33fee6b56fb01e75335ede4ce98fe7855f0
parent04e62d08f6681d1c456af9437073db0b3e7d045c
Improve newtype deriving

Ross Paterson pointed out a useful generalisation of GHC's
newtype-deriving mechanism.  This implements it.  The idea
is to allow
newtype Wrap m a = Wrap (m a) deriving (Monad, Eq)
where the representation type doesn't start with a type
constructor.

Actually GHC already *did* implement this, but the eta-ok
check in TcDeriv missed a case, so there was a lurking bug.

This patches fixes the documentation too.  drvrun019 tests.
compiler/typecheck/TcDeriv.lhs
docs/users_guide/glasgow_exts.xml