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 を追加するように指示されます。ここでこれらの拡張機能は必要ないと思います。このインスタンスをコンパイルするにはどうすればよいですか?