Opened 6 years ago

Closed 6 years ago

Last modified 17 months ago

#8016 closed bug (duplicate)

case expression with mixed use of Num instances cause spurious overlap warning

Reported by: bscarlet Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.3
Keywords: case overlap, PatternMatchWarnings Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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"


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

Change History (2)

comment:1 Changed 6 years ago by monoidal

difficulty: Unknown
Resolution: duplicate
Status: newclosed

I'm closing as a duplicate of #322. Unfortunately GHC's pattern matching warnings need an overhaul.

comment:2 Changed 17 months ago by simonpj

Keywords: PatternMatchWarnings added
Note: See TracTickets for help on using tickets.