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

Duncan Coutts duncan.coutts at googlemail.com
Tue Nov 8 12:21:48 CET 2011


On Mon, 2011-11-07 at 18:51 +0100, Bas van Dijk wrote:

> Once we have (<>) = mappend we could make two nice refactorings in GHC
> similarly to what I did in these unapplied patches:
> 
> http://hackage.haskell.org/trac/ghc/attachment/ticket/4834/ghc_new_monad_hierarchy.dpatch
> 
> Wed Dec  8 15:54:57 CET 2010  Bas van Dijk <v.dijk.bas at gmail.com>
>   * Make SDoc an abstract newtype and add a Monoid instance for it
>   The (<>) combinator of SDocs is removed and replaced by the
>   more general (<>) = mappend combinator from Util.

That's more or less what I did (though SDoc had previously been changed
to a newtype), and ran into the issues I described to do with changing
the meaning of

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

Since SDoc mirrors the Pretty.Doc type, then changing the pretty package
faces the same issues.

As other people have pointed out, the meaning of these constructs is
pretty suspect anyway. We have two associative operators with the same
precedence which do not associate with each other.

Duncan




More information about the Libraries mailing list