#1307: Warning refers to code not in the source
-------------------------+--------------------------------------------------
    Reporter:  guest     |        Owner:         
        Type:  bug       |       Status:  new    
    Priority:  lowest    |    Milestone:  _|_    
   Component:  Compiler  |      Version:  6.7    
    Severity:  normal    |   Resolution:         
    Keywords:            |   Difficulty:  Unknown
          Os:  Windows   |     Testcase:         
Architecture:  Unknown   |  
-------------------------+--------------------------------------------------
Comment (by igloo):

 The warning referring to `notElem` isn't incorrect, though; it's just
 specifying which cases (it thinks) aren't handled.

 For example, if you compile
 {{{
 cap :: String -> String
 cap ('_':cs) = cap cs
 cap ('!':cs) = cap cs
 cap "" = ""
 }}}
 with `-Wall` then you get the warning
 {{{
 Warning: Pattern match(es) are non-exhaustive
          In the definition of `cap':
              Patterns not matched: (GHC.Base.C# #x) : _ with #x `notElem`
 ['_', '!']
 }}}
 i.e. it is telling you that you have not handled the case (x:xs) where x
 is not
 one of ['_', '!'].

 It does seem odd that it thinks that you have missing cases in your
 function, though.
 My HEAD, which claims to be 6.7.20070420, doesn't generate that warning.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1307>
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

Reply via email to