Skip to content

Binding (~) or (@) is rejected in TH splices

8168b42a (from GHC 9.0 onwards) allows GHC to accept the following infix operators:

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

But not if TH is used to generate those declarations:

{-# LANGUAGE TemplateHaskell #-}

$([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.()

Expected behavior: both variants are accepted.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information