summaryrefslogtreecommitdiff
path: root/testsuite/tests/deSugar/should_run/dsrun009.hs
blob: 104f1af2e310bd4ef8af0dc24e31a43f9b2e19b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
-- !!! Test that 'negate' is used properly to construct negative literals

main = print (minusTwo,trueOrFalse)

minusTwo = -2::N

trueOrFalse =
    case minusTwo of
      -2 -> True
      _ -> False

data N = Negate N | FromInteger Integer deriving (Eq,Show)

instance Num N where
  negate = Negate
  fromInteger = FromInteger