[Haskell-cafe] ANNOUNCE: enumerator, an alternative iteratee
package
wren ng thornton
wren at freegeek.org
Thu Aug 19 17:36:22 EDT 2010
John Millikin wrote:
> If you can recall the reasoning behind using ListLike or StreamChunk,
> it would be useful. Their advantages over simply using lists is not
> obvious to me.
Well, one benefit is for efficient use of ByteStrings. Because the
StreamChunk/ListLike class allows for non-parametric containers, you can
use the fact that ByteString is a container of Word8 without unpacking
it into a [Word8] first. Unpacking ByteStrings is horribly inefficient
and is almost never necessary.
As for why ListLike and StreamChunk are separate classes instead of just
having "class StreamChunk full elem | full -> elem", ...that I don't
know. Personally, I dislike ListLike because it has far too many methods.
--
Live well,
~wren
More information about the Haskell-Cafe
mailing list