Chapter 13. Working with asynchronous computations

 

This chapter covers

  • Using Task to represent asynchronous computations
  • Composing asynchronous operations sequentially and in parallel
  • Traversables: handling lists of elevated types
  • Combining the effects of different monads

In today’s world of distributed applications, many operations are performed asynchronously. A program may begin some operation that takes a relatively long time, such as requesting data from another application, but it won’t sit idle, waiting for that operation to complete. Instead, it will go on to do other work and resume the operation once the data has been received.

Asynchrony certainly is the bread and butter of today’s programmer. I waited until this late in the book to deal with it because it adds a level of complexity, which I wanted to postpone in order to make the ideas presented so far more approachable.

Asynchronous operations are represented in C# using Tasks, and in the first half of this chapter you’ll see that Task<T> is not so different from other containers, such as Option<T>, Try<T>, and so on.

13.1. Asynchronous computations

13.2. Traversables: working with lists of elevated values

13.3. Combining asynchrony and validation (or any other two monadic effects)

Summary

sitemap