Skip to content
  • Simon Peyton Jones's avatar
    Some tidying up of type pretty-printing · ad14efd5
    Simon Peyton Jones authored
    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.
    ad14efd5