Proposal: add Monoid1 and Semigroup1 classes

Edward Kmett ekmett at
Sat Oct 1 08:07:51 UTC 2016

I'm somewhat weakly against these, simply because they haven't seen broad
adoption in the wild in any of the attempts to introduce them elsewhere,
and they don't quite fit the naming convention of the other Foo1 classes in

Eq1 f says more or less that Eq a => Eq (f a).

Semigroup1 in your proposal makes a stronger claim. Semgiroup1 f  is saying
forall a. (f a) is a semigroup parametrically. Both of these constructions
could be useful, but they ARE different constructions.

If folks had actually been using, say, the Plus and Alt classes from
semigroupoids or the like more or less at all pretty much anywhere, I could
maybe argue towards bringing them up towards base, but I've seen almost
zero adoption of the ideas over multiple years -- and these represent yet
_another_ point in the design space where we talk about semigroupal and
monoidal structures where f is a Functor instead. =/

Many points in the design space, and little demonstrated will for adoption
seems to steers me to think that the community isn't ready to pick one and
enshrine it some place central yet.

Overall, -1.


On Fri, Sep 30, 2016 at 7:25 PM, David Feuer <david.feuer at> wrote:

> I've been playing around with the idea of writing Haskell 2010 type
> classes for finite sequences and non-empty sequences, somewhat similar to
> Michael Snoyman's Sequence class in mono-traversable. These are naturally
> based on Monoid1 and Semigroup1, which I think belong in base.
> class Semigroup1 f where
>   (<<>>) :: f a -> f a -> f a
> class Semigroup1 f => Monoid1 f where
>   mempty1 :: f a
> Then I can write
> class (Monoid1 t, Traversable t) => Sequence t where
>   singleton :: a -> t a
>   -- and other less-critical methods
> class (Semigroup1 t, Traversable1 t) => NESequence where
>   singleton1 :: a -> t a
>   -- etc.
> I can, of course, just write my own, but I don't think I'm the only one
> using such.
> _______________________________________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list