(un-)deprecation of Control.Monad.Error

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Sat Oct 27 13:53:48 UTC 2018


Dear list,

I'm unhappy about the current state of Control.Monad.Error; the module
is deprecated, stating:

    Module ‘Control.Monad.Error’ is deprecated:
      Use "Control.Monad.Except" instead

However, Control.Monad.Except implements 'fail' as an error, inheriting
the behavior of Identity. To my mind the whole point of
Control.Monad.Error is that it replicates the old non-error behavior of
`fail` that the Either type and EitherT used to have. To wit:

  > fail "123" :: ErrorT String Identity ()
  ErrorT (Identity (Left "123"))

  > fail "123" :: Except String ()
  ExceptT (Identity *** Exception: 123

In this light I find this deprecation message disingenuous.

The situation is similar with the MonadFail class; there is are

  instance (Monad m, Error e) => MonadFail (ErrorT e m)

and

  instance MonadFail m => MonadFail (ExceptT e m)

which means that Except doesn't have a MonadFail instance,
because Identity has none, whereas ErrorT implements a non-error
version of `fail`.

Can we undeprecate the Control.Monad.Error module?

Cheers,

Bertram



More information about the Libraries mailing list