case expression with mixed use of Num instances cause spurious overlap warning
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 -> ...
Trac metadata
Trac field | Value |
---|---|
Version | 7.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |