Proposal: Make Semigroup as a superclass of Monoid

David Feuer david.feuer at
Sun Mar 29 14:49:04 UTC 2015

There is no such general extension as far as I know, but the same code that
produced warnings about impending AMP in 7.8 should work for this.
On Mar 29, 2015 10:31 AM, "Mario Blažević" <blamario at> wrote:

> On 03/29/2015 08:20 AM, Jeremy 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.
>     I wasn't aware GHC provided a mechanism to do something like this. If
> it does, that is great news indeed. Can you point to the GHC extension (or,
> if not implemented yet, the ticket for creating the extension)?
>     Just to clarify, I'm +1 for the proposal. Even without any GHC magic,
> I'd be +1 for making Semigroup a superclass of Monoid even if it went
> through the same code-breaking steps as AMP.
> _______________________________________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list