
You'd instead want to warn about "default branch", e.g.
case <foo> | [] -> ... | (1 : xs) -> ... | (_ : xs) -> ...
here the wildcard pattern does correspond to a "default branch" and might hence deserve a warning.
This sounds promising, but how would you define “default branch”? Seems like it could be an involved definition, which could make the warning unpredictable for users.
A "default branch" seems to correspond to a wildcard overlapping a previous pattern. This would be a warning symmetrical to -Woverlapping-patterns. - A wildcard which overlaps with a pattern below it makes the latter unreachable, which is certainly not intentional. This is caught by -Woverlapping-patterns. case x of _ -> y C -> z - A wildcard which overlaps with a pattern above it has the risk mentionned in this thread, that it will catch any new constructor added to the corresponding ADT, and thus the programmer may forget to update some case expressions when the new constructor is to be handled differently. case x of C -> y _ -> z Li-yao