17 Traversable and stacked monads

This chapter covers

  • Traversables: handling lists of elevated types
  • Combining the effects of different monads

So far in the book you’ve seen a number of different containers that add some effect to the underlying value(s)—Option for optionality, IEnumerable for aggregation, Task for asynchrony, and so on. As our list of containers keeps growing, we’ll inevitably hit the problem of combining different containers:

  • If you have a list of Tasks that you want to execute, how can you combine them into a single Task that will complete when all the operations have completed?

  • If you have a value of type Task<Validation<T>>, how do you compose it with a function of type T Task<R> with the least amount of noise? ...

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