Ticket #851 (closed bug: wontfix)
Incomplete-pattern checking for n+k patterns is not implemented
| Reported by: | simonpj | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | _|_ |
| Component: | Compiler | Version: | 6.4.2 |
| Keywords: | warnings | Cc: | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | None/Unknown | Difficulty: | Unknown |
| Test Case: | ds061 | Blocked By: | |
| Blocking: | Related Tickets: |
Description
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 ticket:595
Change History
Note: See
TracTickets for help on using
tickets.
