[GHC] #12942: Add infix flag for class and data declarations

GHC ghc-devs at haskell.org
Sat Dec 10 23:22:20 UTC 2016


#12942: Add infix flag for class and data declarations
-------------------------------------+-------------------------------------
        Reporter:  alanz             |                Owner:  mpickering
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #3384             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by mpickering):

 * owner:  alanz => mpickering


Comment:

 I didn't notice this before but there is something wrong with this
 constraint and we should clean it up before someone forgets.

 The first thing which is wrong is that it already nearly exists in GHC and
 is called `NamedThing`, so we should just try to use that rather than this
 new class.

 The second thing, in both cases it is used to check whether a variable is
 an infix operator or not and then either calls `pprInfixOcc` or
 `pprPrefixOcc`.
 It would seem better to add a new method to `OutputableBndr` which also
 does this check rather than do it every time we need to know.
 Something like `pprInPos :: (SDoc -> SDoc) -> (SDoc -> SDoc) -> SDoc`
 where the two continuations describe how to deal with the two cases that
 the indentified is infix or prefix might be better.

 Another very good question is why `pprBooleanFormulaNormal` isn't
 parametrised by `OutputableBndr` as well when it very clearly outputs
 `Bndr`s.

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


More information about the ghc-tickets mailing list