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

Fault tolerance

To keep the example simple, in the parallel example we have used the fetch function from the sequential example to fetch the contents of a certain URL:

val links = fetch(url).getOrElse(Set()).filter(!visited(_))

The motivation for having this function return an Option was fault tolerance in the sequential example—if the result cannot be computed, we return a None. However, in an actor setting, Akka provides you with a framework to specify what to do if an actor has failed. So in principle, we could further refine our example with a dedicated fetch function that is perfectly capable of throwing exceptions. However, you might want to specify the actor-level logic on how to restart itself and how to keep its state through this ...

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