If I define the monad transformer type for Identity
, it is able to derive the Show
instance.
newtype IdentityT f a =
IdentityT { runIdentityT :: f a }
deriving (Show)
will derive
instance Show (f a) => Show (IdentityT f a)
But if I define the monad transformer type for Maybe
newtype MaybeT m a =
MaybeT { runMaybeT :: m (Maybe a) }
deriving (Show)
I get the error
• No instance for (Show (m (Maybe a)))
arising from the first field of ‘MaybeT’ (type ‘m (Maybe a)’)
Since Maybe a
has a Show
instance, I would expect it to work and derive
instance Show (m (Maybe a)) => Show (MaybeT m a)
Why can't it?