I have the following newtype
:
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
newtype Wrap m a = Wrap {runWrap :: m a}
deriving (Functor, Applicative, Monad, MonadTrans)
I'm trying to derive MonadTrans
automatically, but I get the following error:
• Can't make a derived instance of ‘MonadTrans Wrap’
(even with cunning GeneralizedNewtypeDeriving):
cannot eta-reduce the representation type enough
• In the newtype declaration for ‘Wrap’
However, writing the trivial instance for MonadTrans
works just fine:
instance MonadTrans Wrap where
lift = Wrap
What is the reason for such an error message?