[GHC] #13677: Incorrect parenthesization of type in error message

GHC ghc-devs at haskell.org
Fri May 26 12:22:37 UTC 2017


#13677: Incorrect parenthesization of type in error message
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D3570
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Simon Peyton Jones <simonpj@…>):

 In [changeset:"ad14efd539377aaf472ad69449dcaf3e679b0e51/ghc" ad14efd/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="ad14efd539377aaf472ad69449dcaf3e679b0e51"
 Some tidying up of type pretty-printing

 Triggered by the changes in #13677, I ended up doing a bit of
 refactoring in type pretty-printing.

 * We were using TyOpPrec and FunPrec rather inconsitently, so
   I made it consisent.

 * That exposed the fact that we were a bit undecided about whether
   to print
      a + b -> c + d   vs   (a+b) -> (c+d)
   and similarly
      a ~ [b] => blah  vs   (a ~ [b]) => blah

   I decided to make TyOpPrec and FunPrec compare equal
   (in BasicTypes), so (->) is treated as equal precedence with
   other type operators, so you get the unambiguous forms above,
   even though they have more parens.

   We could readily reverse this decision.
   See Note [Type operator precedence] in BasicTypes

 * I fixed a bug in pretty-printing of HsType where some
   parens were omitted by mistake.
 }}}

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


More information about the ghc-tickets mailing list