In this chapter, you’ll first learn why it’s sometimes desirable to define lazy computations, functions that may or may not be evaluated. You’ll then see how these functions can be composed with other functions independently of their evaluation.
Once you’ve got your feet wet with lazy computations, which are just plain functions, you’ll see how the same techniques can be extended to computations that have some useful effect other than laziness. Namely, you’ll learn how to use the Try delegate to safely run code that may throw an exception and how to compose several Trys. You’ll then learn how to compose functions that take a callback without ending up in callback hell.
What holds all these techniques together is that, in all cases, you’re treating functions as things that have certain specific characteristics, and you can compose them independently of their execution. This requires a leap in abstraction, but the result is quite powerful.