ByteString I/O Performance

Peter Simons simons at
Wed Sep 5 04:31:07 EDT 2007

apfelmus writes:

 > Remember that Haskell expressions are evaluated lazily, that's
 > why we have the IO monad for doing input/output.

I see. Thank you for the clarification.

 > Hence, mutable values that look like pure ones become
 > unpredictable and are considered a major sin in Haskell land,
 > please don't do it.

It feels patronizing to tell someone else what he should or
shouldn't do. What can I say? Outside of Haskell land there are
people who believe that software should, like, work, instead of
falling apart whenever you feed it input data larger than a few
kilobytes and to reach that objective those people are absolutely
prepared to face the wild unpredictability of -- *gasp* --

 > As catBuf crucially depends on the mutability of the buffer,
 > ByteStrings are not the right data structure to use in that
 > case, that's all there is to it.

A ByteString is a pointer, a byte size, and a byte offset. As
such, it is the perfect data structure for a program like catBuf.

Let's agree to disagree.

Best regards,

More information about the Libraries mailing list