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

Monad Transformers

The problem here is that the flatMap function is defined on the Future. It knows nothing about the type parameter of Future. This can be anything you can imagine. Implementation does not place any constraints on the type parameter. It also means that it knows nothing about this type signature and its properties. Hence, neither the Monad nor the Future default implementation of flatMap for Future is aware of the possibility that the type parameter to Future will be another effect type. So, when you stack our effect types in the manner discussed earlier, only the topmost effect type gets abstracted when we are using the flatMap function.

This behavior is unnatural. We didn't get what we expected. What did we expect to get? ...

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