summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser/should_compile/LexNegVsNegLit.hs
blob: 665893e95b5a1824ccbf2f126cf672b3af413649 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{-# LANGUAGE NegativeLiterals, LexicalNegation #-}

module LexNegVsNegLit where

-- NegativeLiterals specifies that we parse x-1 as x (-1), even though it's
-- considered a shortcoming.
--
-- LexicalNegation does not change that.
--
b :: Bool
b = even-1  -- parsed as: even (-1)
            -- so it is well-typed.
            --
            -- with LexicalNegation alone, we'd get (-) even 1,
            -- but NegativeLiterals takes precedence here.

-- See also: GHC Proposal #344