Proposal #3339: Add (+>) as a synonym for mappend
ekmett at gmail.com
Sun Nov 6 23:36:43 CET 2011
On Sun, Nov 6, 2011 at 4:46 PM, Duncan Coutts
<duncan.coutts at googlemail.com>wrote:
> > Ultimately no code breaks, after all it is changing the associativity of
> > 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.
Bah. Good point.
> 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.
Reasonable, but there is the caveat that causes another problem, which is
that now <+>, : and ++ conflict, which was why we had to raise <> to 6 in
the first place. We could adopt your proposed fix one level up though with:
infixr 7 <>
infixr 6 <+>
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries