[Haskell-cafe] The Proliferation of List-Like Types

Henning Thielemann lemming at henning-thielemann.de
Wed Feb 20 23:07:46 EST 2008

On Thu, 21 Feb 2008, Roman Leshchinskiy wrote:

> John Goerzen wrote:
> > 2) Would it make sense to make ListLike, or something like it,
> >    part of the Haskell core?
> I don't think ListLike is the right approach. It's basically a fairly
> arbitrary collection of functions. It would be preferable, IMO, to
> identify a small set of combinators which would allow most list/sequence
> functions to be implemented generically and efficiently. Personally, I'd
> go with something like streams (the stream fusion ones) but I'm biased,
> of course.

As long as it is only about speeding up list processing, one might also
consider this as optimization problem. This could be handled without
adapting much List based code in applications to a generic sequence class.
That is, if I convert the result of a composition of list functions to a
lazy ByteString, I tell the compiler that I don't need full laziness and
the compiler can optimize, say
   ByteString.fromList . List.func1 . List.func2 . List.build
   ByteString.func1 . ByteString.func2 . ByteString.build
 or even better
 by some clever fusion framework. I think that a type class is easier to
justify if it unifies data structures that are more different than just
providing the same API with different efficiency.

More information about the Haskell-Cafe mailing list