Module documentation for 188.8.131.52
A typeclass abstraction over much of Control.Concurrent (and some extras!). If you're looking for a general introduction to Haskell concurrency, you should check out the excellent Parallel and Concurrent Programming in Haskell, by Simon Marlow. If you are already familiar with concurrent Haskell, just change all the imports from Control.Concurrent. to Control.Concurrent.Classy. and fix the type errors.
A brief list of supported functionality:
- Threads: the
forkOn*functions, although bound threads are not supported.
- Getting and setting capablities.
- Yielding and delaying.
- Mutable state: STM,
- Atomic compare-and-swap for
- All of the data structures in Control.Concurrent. and Control.Concurrent.STM. have typeclass-abstracted equivalents.
- A reimplementation of the async package, providing a
higher-level interface over threads, allowing users to conveniently
MonadConcoperations asynchronously and wait for their results.
This is quite a rich set of functionality, although it is not complete. If there is something else you need, file an issue!
This used to be part of dejafu, but with the dejafu-0.4.0.0 release, it was split out into its own package.
The documentation of the latest developmental version is available online.
Why this and not something else?
Why not base: like lifted-base, concurrency uses typeclasses to make function types more generic. This automatically eliminates calls to
liftin many cases, resulting in clearer and simpler code.
Why not lifted-base: fundamentally, lifted-base is still using actual threads and actual mutable variables. When using a concurrency-specific typeclass, this isn't necessarily the case. The dejafu library provides non-IO-based implementations to allow testing concurrent programs.
Why not IOSpec: IOSpec provides many of the operations this library does, however it uses a free monad to do so, which has extra allocation overhead. Furthermore, it does not expose enough of the internals in order to accurately test real-execution semantics, such as relaxed memory.
Bug reports, pull requests, and comments are very welcome!
Feel free to contact me on GitHub, through IRC (#haskell on freenode), or email (email@example.com).
All notable changes to this project will be documented in this file.
This project is versioned according to the Package Versioning Policy, the de facto standard Haskell versioning scheme.
- Date 2017-11-05
- Git tag concurrency-184.108.40.206
- Hackage https://hackage.haskell.org/package/concurrency-220.127.116.11
fromIsConcfunctions), where a value of type
IsConc m acan only be constructed if
IsSTM (STM m). (#144)
The provided transformer instances now use the
modifyCRefCAS_of the underlying monad, rather than the default definition in terms of
fromIsSTMfunctions), where a value of type
IsSTM m acan only be constructed if
- Date 2017-10-14
- Git tag concurrency-18.104.22.168
- Hackage https://hackage.haskell.org/package/concurrency-22.214.171.124
Fixes an infinite loop introduced for the
forkOnWithUnmaskin 126.96.36.199 (#134).
- Date 2017-10-11
- Git tag concurrency-188.8.131.52
- Hackage https://hackage.haskell.org/package/concurrency-184.108.40.206
MonadConcnow names threads with
GHC.Conc.labelThread, so thread names now appear in debugging traces of normal execution.
- Date 2017-10-02
- Git tag concurrency-220.127.116.11
- Hackage https://hackage.haskell.org/package/concurrency-18.104.22.168
New named-thread variants of the
- Date 2017-09-16
- Git tag concurrency-22.214.171.124
- Hackage https://hackage.haskell.org/package/concurrency-126.96.36.199
MonadSTMnow has a
retryfunctions have been promoted to top-level definitions, and are aliases for
- Date 2017-06-07
- Git tag concurrency-188.8.131.52
- Hackage https://hackage.haskell.org/package/concurrency-184.108.40.206
isEmptyMVarfunction is now implemented using
tryReadMVarinstead of a combination of
putMVar. It no longer modifies the contents of the
MVarand can no longer block.
There is now a changelog.
- Date 2017-04-05
- Git tag concurrency-220.127.116.11
- Hackage https://hackage.haskell.org/package/concurrency-18.104.22.168
- New functions:
uninterruptibleCancelfunction, which is
cancelinside an uninterruptible mask.
replicateConcurrentlyfunction, which performs an action many times in separate threads.
replicateConcurrently_functions, which discard the result of the non-_ version.
- New instances:
Concurrentlywhen built with base 4.9.
uninterruptibleMask_functions from Control.Monad.Catch are now re-exported.
withAsyncfunctions now block until the
Asyncaction terminates, to match changes in the main async package.
Every definition, class, and instance now has a Haddock "@since" annotation.
- Date 2017-03-04
- Git tag concurrency-22.214.171.124
- Hackage https://hackage.haskell.org/package/concurrency-126.96.36.199
The async-dejafu package has been pulled into this package as the Control.Concurrent.Classy.Async module. async-dejafu is now deprecated.
- Date 2017-02-21
- Git tag concurrency-188.8.131.52
- Hackage https://hackage.haskell.org/package/concurrency-184.108.40.206
MonadConcclass now defines
tryReadMVar, a non-blocking version of
MonadConcclass no longer defines
_concMessage, there is no alternative provided, it is just gone.
- Date 2016-09-10
- Git tag concurrency-220.127.116.11
- Hackage https://hackage.haskell.org/package/concurrency-18.104.22.168
Initial release. Go read the API docs.