这个从http://book.realworldhaskell.org/read/monad-transformers.html复制的 MonadState 实例给我一个 GHC 7.4.2 错误
instance (MonadState s m) => MonadState s (MaybeT m) where
get = lift get
put k = lift (put k)
给
Illegal instance declaration for `MonadState s (MaybeT m)'
(All instance types must be of the form (T a1 ... an)
where a1 ... an are *distinct type variables*,
and each type variable appears at most once in the instance head.
Use -XFlexibleInstances if you want to disable this.)
In the instance declaration for `MonadState s (MaybeT m)'
如果我添加 XFlexibleInstances,然后我会被告知要添加 XUndecidableInstances - 我认为我不应该在这里需要这些扩展。如何让这个实例编译?