#1551: Incorrect warning: Pattern match(es) are overlapped
-------------------------------------+--------------------------------------
Reporter: Regidor | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 6.6
Severity: minor | Resolution: invalid
Keywords: overlapping patterns | Difficulty: Unknown
Os: Linux | Testcase:
Architecture: x86 |
-------------------------------------+--------------------------------------
Changes (by duncan):
* resolution: => invalid
* status: new => closed
Comment:
This is a misunderstanding of the code. I think you're assuming that the
'a' and 'ab' parameters of the function 'f' are standing for the patterns
"foo" and "bar", which is not the case.
These 'a' and 'ab' parameters are local variables, they have no relation
to the 'a' and 'ab' values you define at the top level.
So if we change the variable names (which is ok as I say, because they're
local names) you can see more clearly that they overlap:
{{{
f x = 0
f y = 1
}}}
both patterns 'x' and 'y' will match any input value, so the first pattern
overlaps the second completely. The second case can never happen. So the
warning message is correct.
Does that make sense?
For questions like this you might want to ask on the haskell-cafe mailing
list:
http://haskell.org/haskellwiki/Mailing_lists
Other resources for learning Haskell:
http://haskell.org/haskellwiki/Learning_Haskell
(I'm closing the bug as invalid)
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1551>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs