Skip to content

Fix (~) and (@) infix operators in TH splices (#23748)

Vladislav Zavialov requested to merge wip/int-index/th-ops-tilde-atsign into master

8168b42a "Whitespace-sensitive bang patterns" allows GHC to accept the following infix operators:

a ~ b = ()
a @ b = ()

But not if TH is used to generate those declarations:

$([d| a ~ b = ()
      a @ b = ()
    |])

-- Test.hs:5:2: error: [GHC-55017]
-- Illegal variable name: ‘~’
-- When splicing a TH declaration: (~_0) a_1 b_2 = GHC.Tuple.Prim.()

This is easily fixed by modifying reservedOps in GHC.Utils.Lexeme.

Fixes #23748

Merge request reports