-Wall and the fail method
Nikita Karetnikov
nikita at karetnikov.org
Fri May 22 10:06:37 UTC 2015
Can -Wall be extended to report pattern match failures in do
expressions, like it does for case expressions?
Prelude> :set -Wall
Prelude> let f = do Just x <- return Nothing; return x
Prelude> let g = case Nothing of Just x -> x
<interactive>:9:9: Warning:
Pattern match(es) are non-exhaustive
In a case alternative: Patterns not matched: Nothing
One can argue that it's similar to undefined, error, and various
unsafeSomething functions, which I think should be reported as well, if
possible. But these things can be found already with a simple grep
while a pattern match cannot.
I bet it has been discussed already, but "fail" is a terrible search
term, so I cannot find anything relevant in the archives nor in the bug
tracker.
More information about the Glasgow-haskell-users
mailing list