Warn if a pattern guard obviates all others
|Reported by:||JohnWiegley||Owned by:|
|Type of failure:||Incorrect warning at compile-time||Difficulty:||Unknown|
|Test Case:||Blocked By:|
The following code, when compiled with -Wall, gives no warnings:
module Main where main :: IO () main = print $ foo (10 :: Int) where foo x | True = (20 :: Int) | x == 10 = (30 :: Int)
I would expect that since the pattern guard | True obviates the following guards, that it would warn about unreachable code. There was a bug in my code today which I tracked down to a code transposition that would have been easily spotted with such a warning.