Chapter 11. Lazy computations, continuations, and the beauty of monadic composition

This chapter covers

  • Lazy computations
  • Exception handling with Try
  • Monadically composing functions
  • Escaping the pyramid of doom with continuations

In this chapter, you’ll first learn why it’s sometimes desirable to define lazy computations; that is, functions that may or may not be executed. You’ll then see how these functions can be composed with other functions, independently of their execution.

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 effects other than laziness. Namely, you’ll learn how to use the Try delegate to safely ...

Get Functional Programming in C# 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.