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

GHC trac at galois.com
Mon Jul 17 18:19:45 EDT 2006


#827: Overlapped pattern warnings for lazy patterns
-----------------------------------+----------------------------------------
    Reporter:  red5_2 at hotmail.com  |        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


More information about the Glasgow-haskell-bugs mailing list