Improve warning for unreachable/overlapping pattern to also take guards into account
Currently, the following program
f :: a -> Bool f x = case x of _ | False -> False _ -> True
generates the warning
warning.curry, line 3.3: Warning: Pattern matches are unreachable In a case alternative: _ -> ...
This is obviously wrong, and is caused by the fact that the guard is not taken into account. A reasonable approach would be to consider only the following guards to always succeed: True
, success
, otherwise
.
In addition, this information may be used to eliminate unreachable alternatives.