Proposal: Make Semigroup as a superclass of Monoid

Conrad Parker conrad at metadecks.org
Sun Mar 29 19:03:55 UTC 2015


On 29 March 2015 at 23:20, Jeremy <voldermort at hotmail.com> wrote:
> The proposal to make Semigroup a superclass of Monoid was discussed a while
> ago [1], and the conclusion was to "put this off until the dust has settled
> from the AMP and FT changes".
>
> 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.
>
> 1. GHC 7.12 will include Semigroup and NonEmpty in base. All Monoid
> instances, and anything else which forms a Semigroup, will have a Semigroup
> instance. GHC will issue a warning when it encounters an instance of Monoid
> which is not an instance of Semigroup.
>
> 2. GHC >7.12 will define Monoid as a subclass of Semigroup.

+1

Conrad.


More information about the Libraries mailing list