MonadFail proposal (MFP): Moving fail out of Monad

Ganesh Sittampalam ganesh at earth.li
Wed Jun 10 11:58:09 UTC 2015


On 09/06/2015 23:26, Johan Tibell wrote:
> Thanks for putting this together.
> 
> The proposal says:
> 
> "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?

Here's a concrete example:

https://mail.haskell.org/pipermail/libraries/2015-March/025166.html

I needed to change some code that used a monad with an explicit fail to
use one without, and I couldn't get the compiler to tell me if it was
using partial pattern matches or not. If it had been then the
refactoring would have caused a nasty behaviour change.

Ganesh



More information about the ghc-devs mailing list