
#11345: Template Haskell's handling of infix GADT constructors is broken -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: RyanGlScott Type: bug | Status: patch Priority: normal | Milestone: Component: Template Haskell | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1744 Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Replying to [comment:7 jstolarek]:
There is no such field in `ConDeclGADT` data constructor, so how can we mark a constructor declaration as infix?
This was my mistake. I thought that infix GADT constructors were marked with their own constructor ''à la'' `InfixCon`, but that turns out not to be the case. Instead, GHC simply checks for three properties in a generalized `PrefixCon`.
what happens when you try to splice an infix `GadtC` into source code in `Convert.hs`?
Indeed, what should happen in such a situation? I believe we should splice a normal GADT constructor because we have no way of expressing the infixity.
Luckily, we don't need to express the infixity directly in the `GadtC`, as it suffices to splice in a `GadtC` with a symbol name and exactly two arguments, plus a separate fixity declaration. GHC takses care of the rest (see the test case in Phab:D1744 for proof).
A GADT constructor is only considered to be declared infix if (a) it is an operator symbol, (b) it has two arguments, (c) it has a fixity declaration.
Can you show me where this happens in code?
These are checked via [https://git.haskell.org/ghc.git/blob/c78fedde7055490ca6f6210ada797190f3c35d8... tcConIsInfixGADT]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11345#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler