Add support for MonadFail in desugaring of do-notation
In ghc-8.6 and later
do (a,b) <- action; return b has type
Monad m => m a (Pattern match cannot fail)
do (1,b) <- action; return b has type
MonadFail m => m a (Pattern match can fail)
action >>= \(1,b) -> return b has type
Monad m => m a
- Without MonadFail the second and third example could be considered equivalent, with MonadFail they are not.
But even now, the second example would have been equal to
failif the pattern match failed, whereas the second would have been a "non-exhaustive pattern match".