Skip to Content
Mastering Functional Programming
book

Mastering Functional Programming

by Anatolii Kmetiuk
August 2018
Intermediate to advanced
380 pages
10h 2m
English
Packt Publishing
Content preview from Mastering Functional Programming

flatMap generalized

In the previous chapter, we have already seen flatMap in the context of the Try type. It was conceptualized as a continuation of a computational that may result in an error. We can extrapolate this conceptualization to the case of Futures. The same way as flatMap was a conceptualization of a continuation of an error-prone computation in the case of Try, it is a continuation of an asynchronous computation in the case of Future.

The role of the flatMap function is more or less the same in the case of any effect type you deal with. It is a continuation of a computation that produces a side effect with another computation that produces the same side effect, but requires the result of the first computation to proceed.

Similarly ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Functional Programming

Learning Functional Programming

Jack Widman

Publisher Resources

ISBN: 9781788620796Supplemental Content