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

Abstraction and the functional example

Let's look at a functional way of writing this example. In the functional world, one abstraction to deal with asynchronous computations is Future. Future has the following signature—Future[A]. This type represents a computation that runs in a separate thread and computes some result, which in our case is A.

A common technique when dealing with Futures is to use callbacks to specify continuations of the computations. A continuation of a computation is an instruction on what to do after the computation has completed. A continuation has access to the result of the computation it continues. This is possible since it runs after the computation terminates.

In most implications of the Future data type, the ...

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