Standard libraries
From this chapter onward, we will more actively see and use code from the Haskell standard libraries. This serves two purposes. Firstly, functions in the standard libraries often serve as good examples of particular programming patterns. Secondly, knowing these library functions (alongside the language features and programming patterns) makes us more fluent programmers.
Haskell comes with a rich set of standard libraries. The most prominent library is called the Prelude. It comes with some of the most heavily used functionality and does not need to be explicitly imported; it is imported by default. Another library that we will use frequently is Data.List, which contains functions related to lists. This library has to be imported explicitly by putting the following declaration at the top of the source file:
import Data.List
This imports all the functionality provided by the library. If only a small subset of that functionality should be imported, it can be...