© 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_21

21. Lazy Evaluation

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

You already know that Haskell is based on lazy evaluation. This means that the expressions are evaluated only when it is necessary. But what is “necessary”? In this chapter, you will get an answer to that question, and you will take a deeper look at lazy evaluation in Haskell.

First, let’s take a look at strict evaluation, which is the opposite of lazy evaluation. Suppose you have this function:
f x y = 2*y

If you call f (1234^100) 3, in strict evaluation the first argument will be evaluated and ...

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.