Is there already a list class?

Jean-Philippe Bernardy jeanphilippe.bernardy at gmail.com
Wed Jan 10 04:25:11 EST 2007


I suggest you have a look a the classes for collections that I've been
working on.
It's an attempt at unifying all collection types in a single framework
of classes.

darcs repository:

http://darcs.haskell.org/packages/collections

On 1/10/07, David Roundy <droundy at darcs.net> wrote:
> On Tue, Jan 09, 2007 at 05:54:11PM -0800, David Roundy wrote:
> > I think you'd want a higher-kinded list type rather than a MPTC:
> >
> > class List l where
> >      cons :: e -> l e -> l e -- you can't make a constructor a member of a class
> >      head :: l e -> e
> >      null :: l e -> Bool
> >      empty :: l e
> >      ...
>
> Okay, this was stupid of me.  As Spencer points out, we wouldn't actually
> want a list type with kind * -> *, because we'd want to support specialized
> lists like Data.Bytestring.  So we'd want something more like
>
> > class List l e, l -> e where
> >      cons :: e -> l -> l
> >      head :: l -> e
> >      null :: l -> Bool
> >      empty :: l
> >      ...
>
> (But I don't like functional dependencies, because they confuse me, and
> hope that associated types end up making it into Haskell'...)
> --
> David Roundy
> http://www.darcs.net
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>


More information about the Libraries mailing list