So far, we have only looked at pure programming in Haskell where there is no interaction with the outside world. That being said, we have actually been using an instance of an interactive program, that being GHCi, which constantly receives some input from us, interprets it, produces a result and waits for further input. Our programs took their inputs explicitly through the code itself and produced some results. But most of the time, we want to create programs that can interact with the outside world, for example, with users or the computer file system. Those things require side-effects by default and are therefore impure, so in this chapter, we will look at how we can make interactive programs in the pure language of Haskell using input/output actions.
Copy link