Making a custom monad transformer an instance of MonadError
问题 I want to make my monad transformer to be an instance of MonadError if the transformed monad is an instance. Basically I want my transformer to behave as the built-in transformers do, for example there is a MonadError instance for StateT : MonadError e m => MonadError e (StateT s m) I tried doing this: instance MonadError e m => MonadError e (MyMonadT m) But GHC started complaining about undecidable instances, apparently the MTL library just enables undecidable instances, but is there any way