O'Reilly logo

Functional Programming in C#: How to write better C# code by Enrico Buonanno

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required