logo       

[GHC] #827: Overlapped pattern warnings for lazy patterns: msg#00055

lang.haskell.glasgow.bugs

Subject: [GHC] #827: Overlapped pattern warnings for lazy patterns

#827: Overlapped pattern warnings for lazy patterns
-----------------------------------+----------------------------------------
Reporter: red5_2@xxxxxxxxxxx | Owner:
Type: feature request | Status: new
Priority: low | Milestone:
Component: Compiler | Version: 6.4.1
Severity: normal | Keywords: overlapped
Os: Unknown | Difficulty: Unknown
Architecture: Unknown |
-----------------------------------+----------------------------------------
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.

--
Ticket URL: <http://cvs.haskell.org/trac/ghc/ticket/827>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise