<div dir="ltr">It probably doesn't belong in -Wall, as it is a fairly common idiom to use fail intentionally this way, but it could pretty easily be added to the 'do' and list/monad comprehension desugaring to issue a separate warning that we don't turn on by default.<div><br></div><div>Making it possible to see where you use 'fail' explicitly might be a nice step on the road towards splitting out MonadFail though. </div><div><br></div><div>Herbert has been working up a plan we can put forth to the community for how to proceed on that front. It may make sense to roll any such warnings into that effort.</div><div><div><br></div><div>-Edward</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 22, 2015 at 8:06 PM, Nikita Karetnikov <span dir="ltr"><<a href="mailto:nikita@karetnikov.org" target="_blank">nikita@karetnikov.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Can -Wall be extended to report pattern match failures in do<br>
expressions, like it does for case expressions?<br>
<br>
Prelude> :set -Wall<br>
Prelude> let f = do Just x <- return Nothing; return x<br>
Prelude> let g = case Nothing of Just x -> x<br>
<br>
<interactive>:9:9: Warning:<br>
    Pattern match(es) are non-exhaustive<br>
    In a case alternative: Patterns not matched: Nothing<br>
<br>
One can argue that it's similar to undefined, error, and various<br>
unsafeSomething functions, which I think should be reported as well, if<br>
possible.  But these things can be found already with a simple grep<br>
while a pattern match cannot.<br>
<br>
I bet it has been discussed already, but "fail" is a terrible search<br>
term, so I cannot find anything relevant in the archives nor in the bug<br>
tracker.<br>
_______________________________________________<br>
Glasgow-haskell-users mailing list<br>
<a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users</a><br>
</blockquote></div><br></div>