August 2018
Intermediate to advanced
380 pages
10h 2m
English
First of all, we need to remark what exactly we mean by the word asynchronous. We mean asynchronous with respect to the thread pool that the IO data type is executed on. We assume that we have no control of the task itself, and we are not able to redefine it. In fact, we do not care about how it is implemented; all we care about is the precise moment when it terminates. The task here is to prevent the threads of this precise IO execution from blocking.
To achieve this, we can use the IO.async method:

This method has a somewhat tricky signature. So, first, let's take a look in brief at what it does. Given a particular computation, ...