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 aThen I can write
class (Monoid1 t, Traversable t) => Sequence t where
singleton :: a -> t a
-- and other less-critical methodsclass (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@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries