It seems to me that Data.Functor.Classes is the natural place for these, but I guess I could stick them somewhere else.


On Sep 30, 2016 9:09 PM, "Mario Blažević" <blamario@ciktel.net> wrote:
On 2016-09-30 07:25 PM, David Feuer 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.


     If the proposal is to add these directly to base, I'm against it. New classes should first be released in a regular package, and only moved to base once they prove useful.


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.


_______________________________________________
Libraries mailing list
Libraries@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries