Overlapped pattern warnings for lazy patterns
The compiler appears to disregard lazy patterns when producing overlapped-pattern warnings. Some detectable overlapped patterns are ignored as a result. For example, the following does not produce a warning:
f x = case x of Just ~1 -> 0
Just _ -> 1
Nothing -> 2
This function cannot return 1 because every value that satisfies the second pattern also satisfies the first.
I think the relevant instances of overlap could be captured by treating ~() patterns as wildcards for the purpose of detecting overlapped patterns.
Trac metadata
Trac field | Value |
---|---|
Version | 6.4.1 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | low |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |