Chapter 8. Input and Output

In this chapter, you’re going to learn how to receive input from the keyboard and print stuff to the screen.

But first, we’ll cover the basics of input and output (I/O):

  • What are I/O actions?

  • How do I/O actions enable us to do I/O?

  • When are I/O actions actually performed?

Dealing with I/O brings up the issue of constraints on how Haskell functions can work, so we’ll look at how we get around that first.

Separating the Pure from the Impure

By now, you’re used to the fact that Haskell is a purely functional language. Instead of giving the computer a series of steps to execute, you give it definitions of what certain things are. In addition, a function isn’t allowed to have side effects. A function can give us back only some ...

Get Learn You a Haskell for Great Good! now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.