Incomplete-pattern checking for n+k patterns is not implemented
The check for incomplete patterns does not understand about n+k patterns. Here's an example:
f 0 = True
f (n+1) = False
GHC says, rather confusingly:
Warning: Pattern match(es) are non-exhaustive
In the definition of `f':
Patterns not matched: #x with #x `notElem` [0#]
The reason is in compiler/deSugar/Check.hs which says
-- Horrible hack. The simplify_pat stuff converts NPlusK pats to WildPats
-- which of course loses the info that they can fail to match. So we
-- stick in a CanFail as if it were a guard.
-- The Right Thing to do is for the whole system to treat NPlusK pats properly
See #595 (closed)
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.4.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | Unknown |
| Architecture | Unknown |