Proposal #3339: Add (+>) as a synonym for mappend
Duncan Coutts
duncan.coutts at googlemail.com
Sun Nov 6 22:46:21 CET 2011
On Sun, 2011-11-06 at 15:52 -0500, Edward Kmett wrote:
> Whichever way you go on this someone might get (slightly) annoyed, since:
>
> Text.PrettyPrint.Leijen
> infixr 6 <>,<+>
That turns out to be ok because in that module the property is:
empty <+> text "foo" = text " foo"
whereas for Text.PrettyPrint.HughesPJ, empty is a unit of <+>.
> Text.PrettyPrint.HughesPJ
> infixl 6 <>,<+>
Actually currently all the fixity declarations have been removed, but
yes that's what they were in previous released versions.
David: presumably this is a mistake? You didn't really mean to remove:
infixl 6 <>
infixl 6 <+>
infixl 5 $$, $+$
when merging with ghc's variant of the pretty print module.
> Ultimately no code breaks, after all it is changing the associativity of an
> operator that is by definition *associative*. ;)
That's what I thought too, but I already gave an example:
a <> empty <+> b
This means different things depending on whether we use infixl or
infixr. And as I noted, this doesn't bite Text.PrettyPrint.Leijen
because it lacks the <+> unit law.
So my tentative suggestion is:
infixr 6 <>
infixr 5 <+>
infixr 4 $$, $+$
So <> binds tighter than <+> and $$ and $+$ are still lower precedence
than <> and <+>, but switched round to being right associative.
Duncan
More information about the Libraries
mailing list