© Stefania Loredana Nita and Marius Mihailescu 2019
Stefania Loredana Nita and Marius MihailescuHaskell Quick Syntax Referencehttps://doi.org/10.1007/978-1-4842-4507-1_11

11. Pattern Matching

Stefania Loredana Nita1  and Marius Mihailescu1
(1)
Bucharest, Romania
 

In Chapter 7, you learned the basics of pattern matching, which is used with functions. In this chapter, you’ll learn more about the details of pattern matching.

Basically, pattern matching means matching values with patterns and binding variables with the matches that succeeded.

Let’s take a closer look at the map function . The type signature and the definition are as follows:
map _ []     = []
map f (x:xs) = f x : map f xs
Here, you can identify four types of patterns .
  • f: This pattern matches ...

Get Haskell Quick Syntax Reference: A Pocket Guide to the Language, APIs, and Library 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.