Proposal: Make Semigroup as a superclass of Monoid
Mario Blažević
blamario at ciktel.net
Sun Mar 29 14:31:23 UTC 2015
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.
More information about the Libraries
mailing list