我有以下内容newtype
:
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
newtype Wrap m a = Wrap {runWrap :: m a}
deriving (Functor, Applicative, Monad, MonadTrans)
我正在尝试MonadTrans
自动派生,但出现以下错误:
• 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’
但是,为工作编写简单的实例MonadTrans
就可以了:
instance MonadTrans Wrap where
lift = Wrap
出现这种错误消息的原因是什么?