Proposal: Make Semigroup as a superclass of Monoid

M Farkas-Dyck strake888 at gmail.com
Mon Mar 30 03:16:33 UTC 2015


On 29/03/2015 at 05:20:33 -0700, Jeremy wrote:
> 1. GHC 7.12 will include Semigroup and NonEmpty in base.

+1 for Semigroup at least.

NonEmpty is simply the cofree comonad of Maybe, so I think we ought to define it either as such or to be compatibly redefinitile as such, e.g.

now:
data NonEmpty a = a .: Maybe (NonEmpty a)

so potentially later:
data Cofree f a = a .: f (Cofree f a)
type NonEmpty = Cofree Maybe

as otherwise we shall have various code using nonsame isomorphic types which one must convert or coerce between for no good reason.

+1 for NonEmpty if so defined, -1 otherwise.

> 2. GHC >7.12 will define Monoid as a subclass of Semigroup.

+1

On 29/03/2015 at 11:23:19 -0400, David Feuer wrote:
> I guess I should get a dog in the fight—I think <> should be the Semigroup method.

+1


More information about the Libraries mailing list