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.
Showing with 10 additions and 12 deletions