Template Haskell panic when splicing an infix expression with a non-variable middle bit
Simple enough:
import Language.Haskell.TH
import Language.Haskell.TH.Syntax
panic = $(let var = varE . mkName in infixApp (var "x") (appE (var "f") (var "y")) (var "z"))
[1 of 1] Compiling Panic ( Panic.hs, interpreted )
ghc: panic! (the 'impossible' happened)
(GHC version 7.0.1 for i386-unknown-linux):
rnExpr: unexpected expression
{6:11-92}
f{v} y{v}
x{v} z{v}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Of course the expression being spliced doesn't make any sense. In fact, I'd think that the only things that make sense in the centre of an infix expression were a single variable or constructor, so that field being of type Exp is arguably way too permissiveP. haskell-src seems to have a data type especially for this purpose - HsQOp
with constructors HsQVarOp HsQName
and HsQConOp HsQName
.
Trac metadata
Trac field | Value |
---|---|
Version | 7.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |