MonadFail proposal (MFP): Moving fail out of Monad

Henning Thielemann lemming at
Sat Jun 13 07:59:15 UTC 2015

On Wed, 10 Jun 2015, David Luposchainsky wrote:

> Hash: SHA1
> On 10.06.2015 00:26, Johan Tibell wrote:
>> "As a consequence, in current Haskell, you can not use Monad-polymorphic code
>> safely, because although it claims to work for all Monads, it might just crash
>> on you. This kind of implicit non-totality baked into the class is terrible."
>> Is this actually a problem in practice? Is there any code we can point to
>> that suffers because of the current state of affairs? Could it be included in
>> the proposal?
> I don't have hard evidence, but the Monad class being partial strikes me as
> pretty backwards in a language where totality and no implicit failures are
> important to the programmers. We try our best to advocate not using certain
> functions like "head" carelessly, but do-notation comes with similar partiality.

As far as I remember, I have never implemented 'fail' in the Monad 
instances I wrote over the years. Thus, splitting off MonadFail would 
reward me with more precise type signatures: The constraint (Monad m) 
would prevent people from calling 'fail' which I have never implemented.

More information about the Libraries mailing list