Proposal: Make Semigroup as a superclass of Monoid

Evan Laforge qdunkan at gmail.com
Sun Mar 29 19:14:45 UTC 2015


On Sun, Mar 29, 2015 at 5:20 AM, Jeremy <voldermort at hotmail.com> wrote:
> Now that 7.10 is out, I would like to re-propose. The proposed plan is
> similar to AMP, but less invasive, as (in my subjective experience)
> user-defined Monoids are much less common than user-defined Monads.

I think I'm generally in favor, but in my experience is the reverse of
this.  I have tons of Monoids and only a few Monads.  All of my Monads
also had Applicative defined because I wanted to use (<$>) and (<*>),
however none of my Monoids have Semigroup, because they all have a
natural mempty, and there's nothing "extra" in Semigroup that would
tempt me to add an instance.  So while AMP meant no changes for me,
"Semi MP" would definitely force code changes in many places (every
'instance .*Monoid', which is 31 in one project).

That said I don't have to worry about backward compatibility so I
don't mind.  For someone who maintains libraries, they would have to
add a dependency on 'semigroup', which is going to pull in a number of
other dependencies, but it mostly seems to be stuff people are
probably already depending on.  Except unordered-containers maybe.


More information about the Libraries mailing list