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 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.