April 2011
Beginner
400 pages
12h 45m
English
In this chapter, we’ll take a look at the syntax that enables you to write Haskell
functions in a readable and sensible manner. We’ll look at how to quickly deconstruct
values, avoid big if else chains, and store the
results of intermediate computations so that you can reuse them multiple
times.
Pattern matching is used to specify patterns to which some data should conform and to deconstruct the data according to those patterns.

When defining functions in Haskell, you can create separate function bodies for different patterns. This leads to simple, readable code. You can pattern match on pretty much any ...