
On Tue, Jan 31, 2017 at 12:56 PM, Li-yao Xia
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
Excellent. That also elegantly covers the case of functions which ignore the argument, like "const x _ = x". Good thinking! --Will