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
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to