[Haskell-cafe] Re: Iteratee-based IO and lightweight monadic

John Lato jwlato at gmail.com
Wed Dec 10 12:22:41 EST 2008

> From: "Artyom Shalkhakov" <artyom.shalkhakov at gmail.com>
> Hello,
> Is anybody planning to use these shiny new ways for doing IO?
> I'm also interested in a fair comparison of ByteString/Binary
> with iteratee-based IO. Has anybody done this?

I would like to use Iteratee-based IO, and have been doing some
experiments with it recently for my problem domain (reading sound
files).  There has been a discussion recently on the haskell-art list
about this specific topic.  I posted some timing/memory data, and
links to my test code, which you should be able to find in the
archives if you're interested.

I have found that, with my specific implementations and test case,
Iteratee-based IO is slightly slower than the most performant
ByteString/Binary code I used, however it uses significantly less
memory and has nice composability.  Also note that my ByteString-based
reader actually reads strict ByteStrings and outputs a stream of UArr
Doubles (from the uvector package) using unsafeInterleaveIO rather
than using lazy ByteStrings directly.  Other implementations made
different choices, which I covered in some detail in the mentioned

Oleg has recently (after I did my tests) published a small library for
reading TIFF files using Iteratees.  This new code offers some
significant advantages over what I was doing with Iteratees, and may
offer performance benefits.  More work for me...

Unfortunately, neither approach (Iteratee nor ByteString) is yet
competitive with hsndfile/libsndfile.  However, an Iteratee layer that
uses hsndfile to read could be implemented, giving the benefits of the
Iteratee approach with high performance.  I believe the hsndfile
authors are interested in this.  It should be very easy to implement.

More information about the Haskell-Cafe mailing list