Lesson 22. Interacting with the command line and lazy I/O
After reading lesson 22, you’ll be able to
- Access command-line arguments
- Use the traditional approach to interacting through I/O
- Write I/O code using lazy evaluation to make I/O easier
Often when people first learn about I/O and Haskell, they assume that I/O is somewhat of a challenge for Haskell because Haskell is all about pure programs and I/O is anything but pure. But there’s another way to view I/O that makes it uniquely suited to Haskell, and somewhat clunky in other programming languages. Often when working with I/O in any language, we talk about I/O streams, but what is a stream? One good way to understand I/O streams is as a lazily evaluated list of characters. STDIN streams ...