Chapter 6. I/O and Streaming

I/O in Haskell is a source of confusion for many. The I/O functions in the base library are lazy and allow the interleaving of I/O side effects with pure code. This produces weird errors at runtime or, even worse, just incorrect behavior without errors. On the other hand, interleaved side-effects allow easy file processing in constant space, among other things. Fortunately, more robust alternatives for streaming have been proposed and implemented as libraries.

In this chapter, we will learn to use some of the most popular streaming libraries. But before that, we will tear down problems with lazy I/O, because it's still often the easiest and most elegant way to do I/O. We will also consider an alternative to lazy I/O, ...

Get Haskell High Performance Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.