| Version 1 (modified by simonmar, 12 months ago) |
|---|
Async package proposal
This is a proposal for the 'async' package to be included in the next major release of the Haskell platform.
Everyone is invited to review this proposal, following the standard procedure for proposing and reviewing packages.
Reviewers may want to first read the previous thread on the libraries list: http://www.haskell.org/pipermail/libraries/2012-June/017892.html. The current API in async-2.0.0.0 was the result of this discussion.
Review comments should be sent to the libraries mailing list by 13 July 2012 so that we have time to discuss and resolve issues before the final deadline on 13 August 2012.
Credits
Proposal author and package maintainer: Simon Marlow
The following individuals contributed to the review process:
- ...
Abstract
The async package provides a higher-level interface over threads, in which an Async a is a concurrent thread that will eventually deliver a value of type a. The package provides ways to create Async computations, wait for their results, and cancel them.
Using Async is safer than using threads in two ways:
- When waiting for a thread to return a result, if the thread dies with an exception then the caller must either re-throw the exception (wait) or handle it (waitCatch); the exception cannot be ignored.
- The API makes it possible to build a tree of threads that are automatically killed when their parent dies (see withAsync).
Documentation and tarball from the hackage page:
Github page:
Rationale
This API helps in three ways:
- by packaging up some functionality that is often reimplemented;
- by avoiding some common mistakes (see the Abstract above);
- and by providing optimised implementations of the abstractions.
Introduction to the API
See the Haddock documentation: http://community.haskell.org/~simonmar/async/Control-Concurrent-Async.html
