
On Sun, 2011-11-06 at 16:37 +0000, Duncan Coutts wrote:
So I was preparing to commit this change in base and validating ghc when I discovered a more subtle issue in the pretty package:
Consider
a <> empty <+> b
The fixity of <> and <+> is critical:
(a <> empty) <+> b = { empty is unit of <> } (a ) <+> b
a <> (empty <+> b) = { empty is unit of <+> } a <> ( b)
Currently Text.Pretty declares infixl 5 <>, <+>. If we change them to be infixr then we get the latter meaning of a <> empty <+> b. Existing code relies on the former meaning and produces different output with the latter (e.g. ghc producing error messages like "instancefor" when it should have been "instance for").
Suggestions?
Ian suggests making <> bind tighter than <+>. Initially it seems to me slightly odd for <+> to have a different precedence to <>, but I can't see any practical problems. So specifically that'd be: infixr 6 <> -- from Data.Monoid infixr 7 <+> -- in Text.Pretty Can anyone see any problems with this? Note that I'm not proposing to change Text.Pretty right now. That can be done by the maintainer later. Right now I'm just making the change in Data.Monoid in base. But I wanted to check if anything did go wrong with Text.Pretty before changing Data.Monoid. Duncan