Is there already a list class?
Spencer Janssen
sjanssen at cse.unl.edu
Tue Jan 9 21:12:54 EST 2007
On Jan 9, 2007, at 7:52 PM, Marc Weber wrote:
> Hello.
>
> Is here the right place to request a list class?
> eg
> class List l e where
> (:) :: e -> l e -> l e
> head :: ..
Note that this approach isn't quite flexible enough. Your example
forces the container type to have kind * -> *, and therefore can't
support certain specialized containers like ByteString.
There is a class like this in the Edison library (http://
www.eecs.tufts.edu/~rdocki01/edison.html), it is called Seq
(Haddocks: http://www.eecs.tufts.edu/~rdocki01/docs/edison/Data-
Edison-Seq.html). However, it suffers the same kind flexibility
issues as your List class. Other classes in Edison take a MPTC
+fundep approach and I'm not sure why Seq doesn't. Can you comment
on this, Rob?
> This might be used in Data.Set, Data.Map
>
> class StorableAsList l e t where
> fromList :: l e -> t
> toList :: t -> l e
This is subsumed by other Edison functionality.
> I'd like to help implementing/ writing it.
>
> Do you consider this beeing a useful enhancement?
Oh yes, but let's avoid reinventing the wheel if at all possible.
Spencer Janssen
More information about the Libraries
mailing list