Generalized newtype deriving 6.6 vs. 6.8
Twan van Laarhoven
twanvl at gmail.com
Sat Nov 3 14:08:25 EDT 2007
Hello,
I noticed there is a difference in generalized newtype deriving between
6.6 and 6.8. In GHC 6.4.1 the following:
> {-# LANGUAGE GeneralizedNewtypeDeriving #-}
>
> import Control.Monad.Error
>
> newtype MyMonad m a = MyMonad (m a)
> deriving (Monad, MonadError String)
correctly gives a derived instance
MonadError String m => MonadError String (MyMonad m)
The new GHC 6.8.1 complains with:
No instance for (MonadError String m)
arising from the 'deriving' clause of a data type declaration
at DeriveTest.hs:(5,0)-(6,36)
Possible fix: add an instance declaration for (MonadError String m)
When deriving the instance for (MonadError String (MyMonad m))
Generalizing the instance to
MonadError e m => MonadError e (MyMonad m)
works in both versions.
Twan
More information about the Glasgow-haskell-users
mailing list