Haskell is one of the few programming languages that use lazy evaluation: computations get performed only when their result is demanded. It is however not so straightforward to combine lazy evaluation with side effects, such as reading from a file.
Lazy I/O is the standard solution to this in the current base libraries, but has its problems. We explain how lazy I/O works, what the problems are, and explore some of the solutions that are being proposed at the moment: iteratees, pipes, stream I/O, etc.
YOU MAY ALSO LIKE:
- Well-Typed's Fast Track to Haskell (in London on 8th - 9th October 2018)
- Well-Typed's Guide to the Haskell Type System (in London on 10th October 2018)
- HaskellX2gether Community Day 2018 (in London on 13th October 2018)
- Well-Typed's Guide to Haskell Performance and Optimization (in London on 15th - 16th October 2018)
Lazy I/O and Alternatives in Haskell
Edsko received his PhD in type systems for functional programming languages from Trinity College in 2008. After that he worked as a postdoctoral researcher proving properties of concurrent programs, before joining Well-Typed as a Haskell Consultant in 2012. As a consultant he has worked on many projects, both proprietary and open source, including Cloud Haskell, Sparkle, and the Hackage Security library. He also teaches Haskell around the world and blogs frequently on advanced Haskell programming topics.