Split concurrency modules into a separate package.

The new 'concurrency' package is starting at version 1.0.0.0 because the
API is already very mature (copied from base).

This breaks the dejafu-0.2 compatibility of async-dejafu.

Closes #51.
This commit is contained in:
Michael Walker 2016-06-20 21:45:34 +01:00
parent f3c546f591
commit 2f0f51ceb6
27 changed files with 214 additions and 67 deletions

View File

@ -23,14 +23,17 @@ exploration of the possible results of your program.
This repository contains dejafu, a concurrency testing library based
on a typeclass abstraction of concurrency, and related libraries.
- dejafu ([hackage 0.4.0.0][dejafu]): Overloadable primitives for
testable, potentially non-deterministic, concurrency.
- concurrency ([hackage 0.1.0.0][concurrency]): A typeclass for
concurrency.
- dejafu ([hackage 0.4.0.0][dejafu]): Systematic testing for Haskell
concurrency.
- dpor ([hackage 0.2.0.0][dpor]): A generic implementation of dynamic
partial-order reduction (DPOR) for testing arbitrary models of
concurrency.
- async-dejafu ([hackage 0.1.2.2][async]): Run MonadConc operations
- async-dejafu ([hackage 0.1.3.0][async]): Run MonadConc operations
asynchronously and wait for their results.
- hunit-dejafu ([hackage 0.3.0.1][hunit]): Deja Fu support for the
@ -43,11 +46,12 @@ There is also dejafu-tests, the test suite for dejafu. This is in a
separate package due to Cabal being bad with test suite transitive
dependencies.
[dejafu]: https://hackage.haskell.org/package/dejafu
[dpor]: https://hackage.haskell.org/package/dpor
[async]: https://hackage.haskell.org/package/async-dejafu
[hunit]: https://hackage.haskell.org/package/hunit-dejafu
[tasty]: https://hackage.haskell.org/package/tasty-dejafu
[concurrency]: https://hackage.haskell.org/package/concurrency
[dejafu]: https://hackage.haskell.org/package/dejafu
[dpor]: https://hackage.haskell.org/package/dpor
[async]: https://hackage.haskell.org/package/async-dejafu
[hunit]: https://hackage.haskell.org/package/hunit-dejafu
[tasty]: https://hackage.haskell.org/package/tasty-dejafu
Features
--------

View File

@ -4,10 +4,12 @@ async-dejafu
The [async][] library provides a higher-level interface over threads,
allowing users to conveniently run IO operations asynchronously and
wait for their results. This package is a reimplementation of async
using the `MonadConc` abstraction from [dejafu][], providing
using the `MonadConc` abstraction from [concurrency][], providing
easy-to-use asynchronous operaitons within an easily-testable
framework.
This package itself is tested with [dejafu][].
When these functions are used in an IO context, the behaviour should
appear identical to the original async package.
@ -22,6 +24,7 @@ Bug reports, pull requests, and comments are very welcome!
Feel free to contact me on GitHub, through IRC (#haskell on freenode),
or email (mike@barrucadu.co.uk).
[docs]: https://docs.barrucadu.co.uk/async-dejafu
[async]: https://hackage.haskell.org/package/async
[dejafu]: https://hackage.haskell.org/package/dejafu
[docs]: https://docs.barrucadu.co.uk/async-dejafu
[async]: https://hackage.haskell.org/package/async
[concurrency]: https://hackage.haskell.org/package/concurrency
[dejafu]: https://hackage.haskell.org/package/dejafu

View File

@ -2,7 +2,7 @@
-- documentation, see http://haskell.org/cabal/users-guide/
name: async-dejafu
version: 0.1.2.2
version: 0.1.3.0
synopsis: Run MonadConc operations asynchronously and wait for their results.
description:
@ -11,10 +11,13 @@ description:
conveniently run IO operations asynchronously and wait for their
results. This package is a reimplementation of async using the
@MonadConc@ abstraction from
<https://hackage.haskell.org/package/dejafu dejafu>, providing
<https://hackage.haskell.org/package/concurrency concurrency>, providing
easy-to-use asynchronous operaitons within an easily-testable
framework.
.
This library itself is tested with
<https://hackage.haskell.org/package/dejafu dejafu>.
.
When these functions are used in an IO context, the behaviour should
appear identical to the original async package.
@ -37,15 +40,15 @@ source-repository head
source-repository this
type: git
location: https://github.com/barrucadu/dejafu.git
tag: async-dejafu-0.1.2.2
tag: async-dejafu-0.1.3.0
library
exposed-modules: Control.Concurrent.Async
-- other-modules:
-- other-extensions:
build-depends: base >=4.8 && <5
, dejafu >=0.2 && <0.5
, exceptions >=0.7 && <0.9
build-depends: base >=4.8 && <5
, concurrency >=1 && <2
, exceptions >=0.7 && <0.9
-- hs-source-dirs:
default-language: Haskell2010
ghc-options: -Wall
@ -54,5 +57,5 @@ test-suite tests
hs-source-dirs: tests
type: exitcode-stdio-1.0
main-is: Main.hs
build-depends: base, async-dejafu, dejafu, HUnit, hunit-dejafu
build-depends: base, async-dejafu, concurrency, dejafu, HUnit, hunit-dejafu
default-language: Haskell2010

20
concurrency/LICENSE Executable file
View File

@ -0,0 +1,20 @@
Copyright (c) 2015, Michael Walker <mike@barrucadu.co.uk>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

42
concurrency/README.markdown Executable file
View File

@ -0,0 +1,42 @@
concurrency
===========
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][parconc], 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 `forkIO*` and `forkOn*` functions, although bound
threads are not supported.
- Getting and setting capablities.
- Yielding and delaying.
- Mutable state: STM, `MVar`, and `IORef`.
- Atomic compare-and-swap for `IORef`.
- Exceptions.
- All of the data structures in Control.Concurrent.* and
Control.Concurrent.STM.* have typeclass-abstracted equivalents.
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][docs].
Contributing
------------
Bug reports, pull requests, and comments are very welcome!
Feel free to contact me on GitHub, through IRC (#haskell on freenode),
or email (mike@barrucadu.co.uk).
[docs]: https://docs.barrucadu.co.uk/concurrency/dejafu-0.4
[parconc]: http://chimera.labs.oreilly.com/books/1230000000929

2
concurrency/Setup.hs Executable file
View File

@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain

94
concurrency/concurrency.cabal Executable file
View File

@ -0,0 +1,94 @@
-- Initial monad-conc.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: concurrency
version: 1.0.0.0
synopsis: A typeclass for concurrency
description:
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 @forkIO*@ and @forkOn*@ functions, although bound
threads are not supported.
.
* Getting and setting capablities.
.
* Yielding and delaying.
.
* Mutable state: STM, @MVar@, and @IORef@.
.
* Atomic compare-and-swap for @IORef@.
.
* Exceptions.
.
* All of the data structures in Control.Concurrent.* and
Control.Concurrent.STM.* have typeclass-abstracted equivalents.
.
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.
.
See the <https://github.com/barrucadu/dejafu README> for more
details.
homepage: https://github.com/barrucadu/dejafu
license: MIT
license-file: LICENSE
author: Michael Walker
maintainer: mike@barrucadu.co.uk
-- copyright:
category: Concurrency
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
source-repository head
type: git
location: https://github.com/barrucadu/dejafu.git
source-repository this
type: git
location: https://github.com/barrucadu/dejafu.git
tag: concurrency-0.1.0.0
library
exposed-modules: Control.Monad.Conc.Class
, Control.Monad.STM.Class
, Control.Concurrent.Classy
, Control.Concurrent.Classy.Chan
, Control.Concurrent.Classy.CRef
, Control.Concurrent.Classy.MVar
, Control.Concurrent.Classy.QSem
, Control.Concurrent.Classy.QSemN
, Control.Concurrent.Classy.STM
, Control.Concurrent.Classy.STM.TVar
, Control.Concurrent.Classy.STM.TMVar
, Control.Concurrent.Classy.STM.TChan
, Control.Concurrent.Classy.STM.TQueue
, Control.Concurrent.Classy.STM.TBQueue
, Control.Concurrent.Classy.STM.TArray
-- other-modules:
-- other-extensions:
build-depends: base >=4.8 && <5
, array >=0.5 && <0.6
, atomic-primops >=0.8 && <0.9
, exceptions >=0.7 && <0.9
, monad-control >=1.0 && <1.1
, mtl >=2.2 && <2.3
, stm >=2.4 && <2.5
, transformers >=0.4 && <0.6
-- hs-source-dirs:
default-language: Haskell2010
ghc-options: -Wall

View File

@ -37,6 +37,7 @@ executable dejafu-tests
-- other-extensions:
build-depends: base
, concurrency
, containers
, dejafu
, exceptions
@ -47,4 +48,4 @@ executable dejafu-tests
, test-framework-hunit
, test-framework-quickcheck2
-- hs-source-dirs:
default-language: Haskell2010
default-language: Haskell2010

View File

@ -12,9 +12,9 @@ Concurrency is nice, deadlocks and race conditions not so much. The
deterministic parallelism, but sometimes we can tolerate a bit of
nondeterminism.
This package provides a class of monads for potentially
nondeterministic concurrency, with an interface in the spirit of GHC's
normal concurrency abstraction.
This package builds on the concurrency package (also in this
repository) by enabling you to systematically and deterministically
test your concurrent programs.
The documentation of the latest developmental version is
[available online][docs]. Examples can be found in the test suite.
@ -23,15 +23,13 @@ The documentation of the latest developmental version is
(dejafu-tests) because Cabal-the-library is a bit naff. See this
[issue][].
`MonadConc` and `IO`
--------------------
Déjà Fu and `IO`
----------------
The intention of the `MonadConc` class is to provide concurrency where
any apparent nondeterminism arises purely from the scheduling
behaviour. To put it another way, a given computation, parametrised
with a fixed set of scheduling decisions, is deterministic. This
assumption is used by the testing functionality provided by
Control.Monad.Conc.SCT.
The core assumption underlying Déjà Fu is that any apparent
nondeterminism arises purely from the scheduling behaviour. To put it
another way, a given computation, parametrised with a fixed set of
scheduling decisions, is deterministic.
Whilst this assumption may not hold in general when `IO` is involved,
you should strive to produce test cases where it does.

View File

@ -3,7 +3,7 @@
name: dejafu
version: 0.4.0.0
synopsis: Overloadable primitives for testable, potentially non-deterministic, concurrency.
synopsis: Systematic testing for Haskell concurrency.
description:
/[Déjà Fu is] A martial art in which the user's limbs move in time as well as space, […] It is best described as "the feeling that you have been kicked in the head this way before"/ -- Terry Pratchett, Thief of Time
@ -14,18 +14,17 @@ description:
provides deterministic parallelism, but sometimes we can tolerate a
bit of nondeterminism.
.
This package provides a class of monads for potentially
nondeterministic concurrency, with an interface in the spirit of
GHC's normal concurrency abstraction.
This package builds on the
<https://hackage.haskell.org/package/concurrency concurrency>
package by enabling you to systematically and deterministically test
your concurrent programs.
.
== @MonadConc@ with 'IO':
== Déjà Fu with 'IO':
.
The intention of the @MonadConc@ class is to provide concurrency
where any apparent nondeterminism arises purely from the scheduling
behaviour. To put it another way, a given computation, parametrised
with a fixed set of scheduling decisions, is deterministic. This
assumption is used by the testing functionality provided by
Test.DejaFu.
The core assumption underlying Déjà Fu is that any apparent
nondeterminism arises purely from the scheduling behaviour. To put
it another way, a given computation, parametrised with a fixed set
of scheduling decisions, is deterministic.
.
Whilst this assumption may not hold in general when 'IO' is
involved, you should strive to produce test cases where it does.
@ -78,24 +77,7 @@ source-repository this
tag: dejafu-0.4.0.0
library
exposed-modules: Control.Monad.Conc.Class
, Control.Monad.STM.Class
, Control.Concurrent.Classy
, Control.Concurrent.Classy.Chan
, Control.Concurrent.Classy.CRef
, Control.Concurrent.Classy.MVar
, Control.Concurrent.Classy.QSem
, Control.Concurrent.Classy.QSemN
, Control.Concurrent.Classy.STM
, Control.Concurrent.Classy.STM.TVar
, Control.Concurrent.Classy.STM.TMVar
, Control.Concurrent.Classy.STM.TChan
, Control.Concurrent.Classy.STM.TQueue
, Control.Concurrent.Classy.STM.TBQueue
, Control.Concurrent.Classy.STM.TArray
, Test.DejaFu
exposed-modules: Test.DejaFu
, Test.DejaFu.Deterministic
, Test.DejaFu.Common
, Test.DejaFu.SCT
@ -110,18 +92,15 @@ library
-- other-modules:
-- other-extensions:
build-depends: base >=4.8 && <5
, array >=0.5 && <0.6
, atomic-primops >=0.8 && <0.9
, concurrency >=1.0 && <1.1
, containers >=0.5 && <0.6
, deepseq >=1.3 && <1.5
, dpor >=0.1 && <0.3
, exceptions >=0.7 && <0.9
, monad-control >=1.0 && <1.1
, monad-loops >=0.4 && <0.5
, mtl >=2.2 && <2.3
, ref-fd >=0.4 && <0.5
, semigroups >=0.16 && <0.19
, stm >=2.4 && <2.5
, transformers >=0.4 && <0.6
, transformers-base >=0.4 && <0.5
-- hs-source-dirs:

View File

@ -116,7 +116,7 @@ assertableP = alwaysTrue $ \r -> case r of
-- | Automatically test a computation. In particular, look for
-- deadlocks, uncaught exceptions, and multiple return values.
--
--
-- This uses the 'Conc' monad for testing, which is an instance of
-- 'MonadConc'. If you need to test something which also uses
-- 'MonadIO', use 'testAutoIO'.

View File

@ -2,11 +2,12 @@ flags: {}
packages:
- async-dejafu
- hunit-dejafu
- tasty-dejafu
- concurrency
- dejafu
- dejafu-tests
- dpor
- hunit-dejafu
- tasty-dejafu
extra-deps: []