#2204: Improve 'patterns not matched' warnings
-------------------------+--------------------------------------------------
    Reporter:  Deewiant  |       Owner:          
        Type:  proposal  |      Status:  new     
    Priority:  normal    |   Component:  Compiler
     Version:  6.8.2     |    Severity:  trivial 
    Keywords:            |    Testcase:          
Architecture:  Multiple  |          Os:  Multiple
-------------------------+--------------------------------------------------
 Compiling the following with `-fwarn-incomplete-patterns`:

 {{{
 module Asdf where

 f :: String -> Int
 f "0" = 0

 g :: Int -> Int
 g 0 = 0
 }}}

 Yields:

 {{{
 asdf.hs:4:0:
     Warning: Pattern match(es) are non-exhaustive
              In the definition of `f':
                  Patterns not matched:
                      []
                      (GHC.Base.C# #x) : _ with #x `notElem` ['0']
                      (GHC.Base.C# '0') : (_ : _)

 asdf.hs:7:0:
     Warning: Pattern match(es) are non-exhaustive
              In the definition of `g':
                  Patterns not matched: GHC.Base.I# #x with #x `notElem`
 [0#]
 }}}

 Losing the 'GHC.Base' stuff along with the various octothorpes would make
 the error messages a lot nicer. Ideally it'd be something like `Patterns
 not matched: x where x `notElem` [0]` for the second case, for instance.

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