#8016: case expression with mixed use of Num instances cause spurious overlap
warning
----------------------------------------------+-----------------------------
Reporter:  bscarlet                           |          Owner:                 
 
    Type:  bug                                |         Status:  new            
 
Priority:  normal                             |      Component:  Compiler       
 
 Version:  7.6.3                              |       Keywords:  case overlap   
 
      Os:  Unknown/Multiple                   |   Architecture:  
Unknown/Multiple
 Failure:  Incorrect warning at compile-time  |      Blockedby:                 
 
Blocking:                                     |        Related:                 
 
----------------------------------------------+-----------------------------
 {{{
 newtype Whomp = Whomp Int
   deriving (Eq)

 instance Num Whomp where
   Whomp a + Whomp b = Whomp (a+b)
   Whomp a * Whomp b = Whomp (a*b)
   abs (Whomp a) = Whomp (abs a)
   signum (Whomp a) = Whomp (signum a)
   fromInteger = Whomp . fromInteger

 foo :: Whomp -> String
 foo cc = case cc of
     Whomp 0 -> "zero"
     10 -> "ten"

 }}}

 produces
 {{{

 Foo.hs:12:10: Warning:
     Pattern match(es) are overlapped
     In a case alternative: Whomp 0 -> ...

 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/8016>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
ghc-tickets mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/ghc-tickets

Reply via email to