id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
4877,Template Haskell panic when splicing an infix expression with a non-variable middle bit,benmachine,simonpj,"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`.",bug,closed,normal,7.2.1,Template Haskell,7.0.1,fixed,,,Unknown/Multiple,Unknown/Multiple,Compile-time crash,,,,,
