summaryrefslogtreecommitdiff
path: root/testsuite/tests/pmcheck/should_compile/T16289.hs
blob: ceb7b4c587ba16d0aa946375cb472efd8364e394 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Lib where

data Value = Finite Integer | Infinity
  deriving (Eq)

instance Num Value where
  (+)         = undefined
  (*)         = undefined
  abs         = undefined
  signum      = undefined
  negate      = undefined
  fromInteger = Finite

-- | @litCon _@ should not elicit an overlapping patterns warning when it
-- passes through the LitCon case.
litCon :: Value -> Bool
litCon Infinity = True
litCon 0        = True
litCon _        = False

-- | @conLit Infinity@ should not elicit an overlapping patterns warning when
-- it passes through the ConLit case.
conLit :: Value -> Bool
conLit 0        = True
conLit Infinity = True
conLit _        = False