Error message mentions pending splices
When I say
{-# LANGUAGE TemplateHaskellQuotes #-}
module Bug where
import Language.Haskell.TH
f :: Q Exp -> Q Exp
f x = [| Just $x |]
I get
Bug.hs:8:7: error:
• No instance for (Language.Haskell.TH.Syntax.Lift (Q Exp))
arising from a use of ‘Language.Haskell.TH.Syntax.lift’
• In the expression: Language.Haskell.TH.Syntax.lift x
In the expression:
[| Just $ x |]
pending(rn) [<x, Language.Haskell.TH.Syntax.lift x>]
In an equation for ‘f’:
f x
= [| Just $ x |]
pending(rn) [<x, Language.Haskell.TH.Syntax.lift x>]
|
8 | f x = [| Just $x |]
| ^^^^^^^^^^^^^
This is unfortunate in at least two ways:
-
The error message mentions pending splices.
-
I clearly wanted to splice
x
. But because I haveTemplateHaskellQuotes
(notTemplateHaskell
), I have actually applied the$
operator.
I suppose this ticket is really about (1), but I wanted to whinge about (2) while I had your attention. Perhaps TemplateHaskellQuotes
should change the parsing of $
, even if splices aren't actually allowed.