July 2023
Beginner to intermediate
488 pages
14h
English
This chapter covers
In this chapter, we’ll take what we’ve learned so far about monads and algebraic data types and extend it to handling external effects, like reading from databases and writing to files. We’ll develop a monad for I/O, aptly called IO, that will allow us to handle such external effects in a purely functional way.
We’ll make an important distinction in this chapter between effects and side effects. The IO monad provides a straightforward way of embedding imperative programming with I/O effects in a pure program, while preserving referential transparency. It clearly separates effectful
Read now
Unlock full access