Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
We described lazy values in Chapter 8. In functional languages that are lazy by default, like Haskell, laziness makes it easy to support infinite data structures.
For example, consider the following Scala method fib that calculates the Fibonacci number for n in the infinite Fibonacci sequence: