#5340: wrong warning on incomplete case analysis in conjunction with empty data
declarations
---------------------------------+------------------------------------------
    Reporter:  Lemming           |       Owner:              
        Type:  bug               |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  6.12.3            |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 I load the following code into GHCi with warnings enabled (-Wall)
 {{{
 {-# LANGUAGE EmptyDataDecls #-}

 data Empty

 data EitherStrict a b = LeftStrict !a | RightStrict !b

 test :: Char
 test =
    case undefined :: EitherStrict Empty Char of
 --      LeftStrict _ -> undefined
       RightStrict b -> b
 }}}

 I get the warning:
 {{{
 CaseOfEmptyData.hs:9:3:
     Warning: Pattern match(es) are non-exhaustive
              In a case alternative: Patterns not matched: LeftStrict _
 }}}

 I think this warning is wrong, since the LeftStrict case cannot happen. Am
 I right?

 This may be related to #2431.

 This problem is of minor priority for me. I found that in the original
 problem EmptyDataDecls would not helped me at all, and I found a better
 solution in this particular case.

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