8

Input/Output

This chapter explains Haskell’s unique way of communicating with the outside world. The outside world is defined as any entities outside of the Haskell program, such as the user, the filesystem, the network, and the operating system. It’s used to display text to a user and get their input, read and write files, access and provide web services, get the current time and date, and so on.

The reason Haskell has a unique approach is twofold:

  • Firstly, lazy evaluation makes working with plain functions for communication purposes impossible from a practical point of view. The order of execution is too unpredictable to have a sensible interaction with a third party.
  • Secondly, a strong principle of the Haskell language is that its functions ...

Get Soar with Haskell 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.