Skip to content

Unify fixity/associativity of <>-ish pretty-printing operators

note See also Proposal/LeftAssocSemigroupOp

This ticket is motivated by GHC's new -fwarn-semigroup, and that <> is moving into Prelude with future GHCs.

Throughout GHC's source there are related pretty-printing operators with subtly different infixr/infixl-declarations.

It would be desirable to unify those and possibly use Semigroup((<>)) instead (where <> represents a semigroup/monoid operation anyway)

Otoh, existing code using <> assumes a different fixity (Monoid/Semigroup have infixr 6 <>), so it may make sense to start by renaming the unconventional <>s into something else.

Modules affected:

  • Outputable: default fixity, i.e. infixl 9 (ghc)
  • Pretty: infixl 6 (ghc)
  • Language.Haskell.TH.PprLib: infixl 6 (template-haskell)

Related discussion: https://github.com/haskell/pretty/issues/30

Edited by Herbert Valerio Riedel
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information