summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser/should_compile/LexicalNegation.hs
blob: 0c12da23be1cfd6ef5d2233e2b3b0c6af45f5152 (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
{-# LANGUAGE LexicalNegation #-}

module LexicalNegation where

import Data.Ratio

x :: Int
x = 42

negx :: Int
negx = f -x  where  f = (- 5)

subx :: Int -> Int
subx = (- x)

assertion1 :: Bool
assertion1 = (- x) -x  ==  -(2*x)

bug19838 :: Rational
bug19838 = a % -b  where  a = 4; b = 6

infixr 6 +!   -- NB: (non-lexical) negation is infixl 6
(+!) = (+)

rfix :: Int
rfix = -x +! 2