[GHC] #11345: Template Haskell's handling of infix GADT constructors is broken

GHC ghc-devs at haskell.org
Wed Jan 6 21:43:01 UTC 2016


#11345: Template Haskell's handling of infix GADT constructors is broken
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  RyanGlScott
            Type:  bug               |               Status:  new
        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):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Actually, here's a better idea.

 My above comment shows that trying to encode whether a GADT constructor is
 declared infix directly into `GadtC` causes problems. But perhaps we don't
 need to do this. In theory, all we have to do is find out if there is a
 fixity declaration for the constructor.

 We're close to being able to do this in Template Haskell already through
 `reifyFixity`. The problem is that `reifyFixity` will return
 `defaultFixity` if it can't discover a user-defined fixity declaration for
 the argument, which leaves the programmer unable to know whether the user
 actually wrote that fixity, or if it's just `defaultFixity`. With a modest
 change to `reifyFixity`,

 {{{#!hs
 reifyFixity :: Name -> Maybe Fixity
 }}}

 where `Nothing` indicates the absence of a user-specified fixity
 declaration, then I think this would work!

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11345#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list