Asynchronous processing

Executing asynchronously involves forking a computation to execute in another thread and right after continuing to do other things. In interactive applications, it is often useful to execute things in the background, in order not to block the user interface for too long. Usually we want to use the results from the asynchronous worker thread once it has finished. Sometimes we wish to cancel a long-running asynchronous computation, in order not to leave unwanted jobs lying around.

Although it is totally possible to create asynchronous jobs with waits and cancels using MVar and perhaps STM, the Async API in the async package provides much nicer solutions.

But first, to be convinced there's nothing magical in the Async API abstraction, ...

Get Haskell High Performance Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.