<p dir="ltr">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.</p>
<p dir="ltr">class Semigroup1 f where<br>
(<<>>) :: f a -> f a -> f a<br>
class Semigroup1 f => Monoid1 f where<br>
mempty1 :: f a</p>
<p dir="ltr">Then I can write</p>
<p dir="ltr">class (Monoid1 t, Traversable t) => Sequence t where<br>
singleton :: a -> t a<br>
-- and other less-critical methods</p>
<p dir="ltr">class (Semigroup1 t, Traversable1 t) => NESequence where<br>
singleton1 :: a -> t a<br>
-- etc.</p>
<p dir="ltr">I can, of course, just write my own, but I don't think I'm the only one using such.<br></p>