Proposal #3339: Add (+>) as a synonym for mappend
ekmett at gmail.com
Fri Jul 17 15:57:06 EDT 2009
The main concern with generalizing (++) is that it was once generalized
-- completely differently! -- for mplus in MonadPlus. So whether Monoid's
mappend is the natural generalization of (++) or MonadPlus's mplus is, is
not entirely clear. Neither one can completely subsume all of the use-cases
of the other.
A secondary concern is that neither MonadPlus nor Monoid are in the Prelude,
so its generalized form would have to be exported from Data.Monoid with a
different type signature breaking any pre-existing code that brought in
Data.Monoid unqualified and happened to use lists.
I'm less sold by the second concern than the first one, but both make me
Bryan's/Jules's existing proposal of a new operator avoids both of these
On Fri, Jul 17, 2009 at 10:53 AM, Alexander Dunlap <
alexander.dunlap at gmail.com> wrote:
> On Tue, Jun 30, 2009 at 5:37 PM, Bryan O'Sullivan<bos at serpentine.com>
> > Ticket: http://hackage.haskell.org/trac/ghc/ticket/3339
> > From the ticket:
> > This proposal was, I think, originally suggested by Jules Bean. The idea
> > to add two functions to the Data.Monoid module, (+>) and (<+),
> > to different uses of mappend. These should not be methods of the Monoid
> > typeclass, but top-level functions.
> > I hope (but slightly doubt) that the visual nature of the two operators
> > might help to counter the thought that monoids are just for gluing things
> > together.
> > (+>) :: (Monoid a) => a -> a -> a
> > a +> b = a `mappend` b
> > (<+) :: (Monoid a) => a -> a -> a
> > a <+ b = b `mappend` a
> > infixl 4 +>
> > infixl 4 <+
> > Proposed deadline: two weeks.
> > If this looks reasonable, I'll attach darcs patches.
> I (and apparently a lot of other people who commented on that ticket)
> would prefer that (++) be generalized instead of introducing a new
> Libraries mailing list
> Libraries at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries