[GHC] #15235: GHCi's claim of infixr 0 (->) is a lie

GHC ghc-devs at haskell.org
Sun Jun 24 12:12:50 UTC 2018


#15235: GHCi's claim of infixr 0 (->) is a lie
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.8.1
       Component:  Compiler          |              Version:  8.4.3
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #15236            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Changing GHCi's fixity information for `(->)` is a simple matter of
 applying this change:

 {{{#!diff
 diff --git a/compiler/basicTypes/BasicTypes.hs
 b/compiler/basicTypes/BasicTypes.hs
 index 93010b7..e9d32f6 100644
 --- a/compiler/basicTypes/BasicTypes.hs
 +++ b/compiler/basicTypes/BasicTypes.hs
 @@ -409,7 +409,7 @@ defaultFixity = Fixity NoSourceText maxPrecedence
 InfixL
  negateFixity, funTyFixity :: Fixity
  -- Wired-in fixities
  negateFixity = Fixity NoSourceText 6 InfixL  -- Fixity of unary negate
 -funTyFixity  = Fixity NoSourceText 0 InfixR  -- Fixity of '->'
 +funTyFixity  = Fixity NoSourceText (-1) InfixR  -- Fixity of '->'

  {-
  Consider
 }}}

 However, there's one more question we should answer before applying this
 change: do we want the displayed `:info` output to be this:

 {{{
 infixr -1 ->
 }}}

 Or this?

 {{{
 infixr (-1) ->
 }}}

 With only the above change, `:info` will display the former. If we want
 the latter, we'd have to make additional changes to the pretty-printer
 output for fixity information to add parentheses.

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


More information about the ghc-tickets mailing list