[GHC] #8016: case expression with mixed use of Num instances cause spurious overlap warning
GHC
ghc-devs at haskell.org
Thu Jun 27 17:10:15 CEST 2013
#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
More information about the ghc-tickets
mailing list