Proposal #3339: Add (+>) as a synonym for mappend

Duncan Coutts duncan.coutts at googlemail.com
Mon Nov 7 02:19:02 CET 2011


On Mon, 2011-11-07 at 01:13 +0000, Duncan Coutts wrote:
> 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
> 
> So having tried to fix this by setting <> higher precedence than <+>, we
> simply run into the reverse problem
> 
> a <+> empty <> b
> 
> The concrete example is in ghc:
> 
>     ptext (sLit "In module")
> <+> quotes (ppr (is_mod decl_spec))
> <+> source_import <> colon

BTW, I should note that it looks like this is the only instance of this
problem in the whole of ghc (based on an analysis of failures in the ghc
testsuite), and ghc uses pretty printing combinators pretty heavily.

So one argument would be to say it's not that bad, just fix the few
places.

Still, it'd be nice to have a more principled explanation for the
meanings of

    a <> empty <+> b
and
    a <+> empty <> b

Duncan




More information about the Libraries mailing list