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

Johan Tibell johan.tibell at
Sun Aug 14 19:27:03 CEST 2011


On Sun, Aug 14, 2011 at 2:43 PM, Yitzchak Gale <gale at> wrote:
> NO please don't do that. It would break all packages
> that do, or soon will, use the semigroups
> package.

They shouldn't unless they use unqualified implicit imports. Using
imports this way is asking for trouble as any time a new identifier is
added to a package you depend on, your code might break. If you do use
unqualified implicit imports you need to be prepared to fix breakages
by adding import lists or qualified imports as needed.

> That proposal is no longer relevant. Every Monoid
> instance should now be made an instance of
> Semigroup. Anyone who wants to use <> should
> import it from there.

This doesn't work well unless SemiGroup is a superclass of Monoid. For
example, class constraints would have to include redundant

    f :: (Monoid a, SemiGroup a) => a -> ...

SemiGroup is redundant here. All monoids are semigroups.

Making SemiGroup a superclass of Monoid is not feasible at the moment,
as we don't have a way (e.g. class aliases) to do so without breaking
lots of code. I don't know of anyone who's actually working on solving
this problem at the moment.

In addition, I don't want to depend on the semigroup package. It needs
more work. For example why does depending on the semigroups package
give me a new type for natural numbers and for non-empty lists?

I don't object to have a class for semigroups in the future, but we're
far from where that is possible in a nice way.


More information about the Libraries mailing list