This MonadState instance, copied from http://book.realworldhaskell.org/read/monad-transformers.html, gives me an error with GHC 7.4.2
instance (MonadState s m) => MonadState s (MaybeT m) where
get = lift get
put k = lift (put k)
gives
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)'
If I add XFlexibleInstances, I'm then told to add XUndecidableInstances instead - I don't think I should need these extensions here. How can get this instance to compile?