In addition to the stress on the state mentioned by Norman and Don, you can also come up with the normal functioning of the application and laziness as a producer and consumer.
Here is the manufacturer of natural numbers:
nats = [1..]
And here is a consumer who calculates the squares of these numbers:
squares = map (\x -> x * x) nats
Manufacturers, such as yield return in C # or generators in Python, can often be expressed as follows: like simple lazy lists in Haskell.
Martijn
source share