diff --git a/README.markdown b/README.markdown index aa96c2e..284ede8 100644 --- a/README.markdown +++ b/README.markdown @@ -42,9 +42,8 @@ Packages | | Version | Intended Users | Summary | | --- | ------- | -------------- | ------- | -| async-dejafu [[docs][d:async]] [[hackage][h:async]] | 0.1.3.0 | Authors | Run MonadConc operations asynchronously and wait for their results. | -| concurrency [[docs][d:conc]] [[hackage][h:conc]] | 1.1.0.0 | Authors | Typeclasses, functions, and data types for concurrency and STM. | -| dejafu [[docs][d:dejafu]] [[hackage][h:dejafu]] | 0.5.1.1 | Testers | Systematic testing for Haskell concurrency. | +| concurrency [[docs][d:conc]] [[hackage][h:conc]] | 1.1.1.0 | Authors | Typeclasses, functions, and data types for concurrency and STM. | +| dejafu [[docs][d:dejafu]] [[hackage][h:dejafu]] | 0.5.1.2 | Testers | Systematic testing for Haskell concurrency. | | hunit-dejafu [[docs][d:hunit]] [[hackage][h:hunit]] | 0.4.0.0 | Testers | Deja Fu support for the HUnit test framework. | | tasty-dejafu [[docs][d:tasty]] [[hackage][h:tasty]] | 0.4.0.0 | Testers | Deja Fu support for the Tasty test framework. | @@ -56,13 +55,11 @@ dependencies. [d:conc]: https://docs.barrucadu.co.uk/concurrency/ [d:dejafu]: https://docs.barrucadu.co.uk/dejafu/ -[d:async]: https://docs.barrucadu.co.uk/async-dejafu/ [d:hunit]: https://docs.barrucadu.co.uk/hunit-dejafu/ [d:tasty]: https://docs.barrucadu.co.uk/tasty-dejafu/ [h:conc]: https://hackage.haskell.org/package/concurrency [h:dejafu]: https://hackage.haskell.org/package/dejafu -[h:async]: https://hackage.haskell.org/package/async-dejafu [h:hunit]: https://hackage.haskell.org/package/hunit-dejafu [h:tasty]: https://hackage.haskell.org/package/tasty-dejafu @@ -71,9 +68,9 @@ Concurrent Programming ---------------------- You should read [Parallel and Concurrent Programming in Haskell][parconc], -by Simon Marlow. It's very good, and the API of the *async-dejafu* and -*concurrency* packages is intentionally kept very similar to the -standard packages, so all the knowledge transfers. +by Simon Marlow. It's very good, and the API of the *concurrency* +package is intentionally kept very similar to the *async*, *base*, and +*stm* packages, so all the knowledge transfers. [parconc]: http://chimera.labs.oreilly.com/books/1230000000929/ @@ -81,9 +78,8 @@ standard packages, so all the knowledge transfers. The wonderful *[async][]* package by Simon Marlow greatly eases the difficulty of writing programs which merely need to perform some -asynchronous IO. The *async-dejafu* package provides an almost-total -reimplementation of *async*, using the abstractions provided by -*concurrency*. +asynchronous IO. The *concurrency* package includes an almost-total +reimplementation of *async*. For example, assuming a suitable `getURL` function, to fetch the contents of two web pages at the same time: diff --git a/async-dejafu/LICENSE b/async-dejafu/LICENSE deleted file mode 100644 index d7ad872..0000000 --- a/async-dejafu/LICENSE +++ /dev/null @@ -1,30 +0,0 @@ -Copyright (c) 2012, Michael Walker - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * Neither the name of Michael Walker nor the names of other - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/async-dejafu/README.markdown b/async-dejafu/README.markdown deleted file mode 100644 index 5f28de7..0000000 --- a/async-dejafu/README.markdown +++ /dev/null @@ -1,30 +0,0 @@ -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 [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. - -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/async-dejafu -[async]: https://hackage.haskell.org/package/async -[concurrency]: https://hackage.haskell.org/package/concurrency -[dejafu]: https://hackage.haskell.org/package/dejafu diff --git a/async-dejafu/Setup.hs b/async-dejafu/Setup.hs deleted file mode 100644 index 9a994af..0000000 --- a/async-dejafu/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/async-dejafu/async-dejafu.cabal b/async-dejafu/async-dejafu.cabal deleted file mode 100644 index 7d6954c..0000000 --- a/async-dejafu/async-dejafu.cabal +++ /dev/null @@ -1,61 +0,0 @@ --- Initial async-dejafu.cabal generated by cabal init. For further --- documentation, see http://haskell.org/cabal/users-guide/ - -name: async-dejafu -version: 0.1.3.0 -synopsis: Run MonadConc operations asynchronously and wait for their results. - -description: - The 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 - , providing - easy-to-use asynchronous operaitons within an easily-testable - framework. - . - This library itself is tested with - . - . - When these functions are used in an IO context, the behaviour should - appear identical to the original async package. - - -homepage: https://github.com/barrucadu/dejafu -license: BSD3 -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: async-dejafu-0.1.3.0 - -library - exposed-modules: Control.Concurrent.Async - -- other-modules: - -- other-extensions: - build-depends: base >=4.8 && <5 - , concurrency >=1 && <2 - , exceptions >=0.7 && <0.9 - -- hs-source-dirs: - default-language: Haskell2010 - ghc-options: -Wall - -test-suite tests - hs-source-dirs: tests - type: exitcode-stdio-1.0 - main-is: Main.hs - build-depends: base, async-dejafu, concurrency, dejafu>=0.4, HUnit, hunit-dejafu - default-language: Haskell2010 diff --git a/async-dejafu/Control/Concurrent/Async.hs b/concurrency/Control/Concurrent/Classy/Async.hs similarity index 97% rename from async-dejafu/Control/Concurrent/Async.hs rename to concurrency/Control/Concurrent/Classy/Async.hs index aed48f1..4910c8d 100644 --- a/async-dejafu/Control/Concurrent/Async.hs +++ b/concurrency/Control/Concurrent/Classy/Async.hs @@ -2,11 +2,9 @@ {-# LANGUAGE RankNTypes #-} -- | This module is a version of the --- package using the --- concurrency --- abstraction. It provides a set of operations for running --- @MonadConc@ operations asynchronously and waiting for their --- results. +-- package. It +-- provides a set of operations for running @MonadConc@ operations +-- asynchronously and waiting for their results. -- -- For example, assuming a suitable @getURL@ function, we can fetch -- the contents of two web pages at the same time: @@ -22,13 +20,13 @@ -- -- There are a few deviations from the regular async package: -- --- * 'asyncBound' and 'withAsyncBound' are missing as dejafu does --- not support bound threads. +-- * 'asyncBound' and 'withAsyncBound' are missing as @MonadConc@ +-- does not support bound threads. -- -- * The @Alternative@ instance for 'Concurrently' uses @forever -- yield@ in the definition of @empty@, rather than @forever -- (threadDelay maxBound)@. -module Control.Concurrent.Async +module Control.Concurrent.Classy.Async ( -- * Asynchronous actions Async diff --git a/concurrency/README.markdown b/concurrency/README.markdown index 128a025..eea1bf1 100755 --- a/concurrency/README.markdown +++ b/concurrency/README.markdown @@ -20,6 +20,10 @@ A brief list of supported functionality: - Exceptions. - 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 + run `MonadConc` operations 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! @@ -59,4 +63,5 @@ 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 +[async]: https://hackage.haskell.org/package/async [parconc]: http://chimera.labs.oreilly.com/books/1230000000929 diff --git a/concurrency/concurrency.cabal b/concurrency/concurrency.cabal index 267b9ee..9ebacc9 100755 --- a/concurrency/concurrency.cabal +++ b/concurrency/concurrency.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: concurrency -version: 1.1.0.0 +version: 1.1.1.0 synopsis: Typeclasses, functions, and data types for concurrency and STM. description: @@ -32,6 +32,12 @@ description: * All of the data structures in Control.Concurrent.* and Control.Concurrent.STM.* have typeclass-abstracted equivalents. . + * A reimplementation of the + package, + providing a higher-level interface over threads, allowing users to + conveniently run @MonadConc@ operations 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! . @@ -78,13 +84,14 @@ source-repository head source-repository this type: git location: https://github.com/barrucadu/dejafu.git - tag: concurrency-1.1.0.0 + tag: concurrency-1.1.1.0 library exposed-modules: Control.Monad.Conc.Class , Control.Monad.STM.Class , Control.Concurrent.Classy + , Control.Concurrent.Classy.Async , Control.Concurrent.Classy.Chan , Control.Concurrent.Classy.CRef , Control.Concurrent.Classy.MVar diff --git a/dejafu-tests/Cases.hs b/dejafu-tests/Cases.hs index b4394f4..9b8a22f 100755 --- a/dejafu-tests/Cases.hs +++ b/dejafu-tests/Cases.hs @@ -5,6 +5,7 @@ import Test.Framework (Test, testGroup) import qualified Cases.SingleThreaded as S import qualified Cases.MultiThreaded as M import qualified Cases.Litmus as L +import qualified Cases.Async as A -- | Run all the test cases. testCases :: [Test] @@ -12,4 +13,5 @@ testCases = map (uncurry testGroup) [ ("Single Threaded", S.tests) , ("Multi Threaded", M.tests) , ("Litmus", L.tests) + , ("Async", A.tests) ] diff --git a/async-dejafu/tests/Main.hs b/dejafu-tests/Cases/Async.hs similarity index 90% rename from async-dejafu/tests/Main.hs rename to dejafu-tests/Cases/Async.hs index aa43abc..a20c2fe 100644 --- a/async-dejafu/tests/Main.hs +++ b/dejafu-tests/Cases/Async.hs @@ -1,22 +1,24 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE LambdaCase #-} -module Main where +module Cases.Async where import Control.Applicative ((<|>)) -import Control.Concurrent.Async +import Control.Concurrent.Classy.Async import Control.Exception (AsyncException(..), BlockedIndefinitelyOnMVar(..), Exception, SomeException(..), fromException) import Control.Monad (forever) import Control.Monad.Conc.Class import Data.Functor (void) import Data.Typeable (Typeable, cast) -import Test.DejaFu hiding (MemType(..)) -import Test.HUnit (Test(..), runTestTT, test) -import Test.HUnit.DejaFu +import Test.Framework (Test, testGroup) +import Test.Framework.Providers.HUnit (hUnitTestToTests) +import Test.DejaFu (alwaysTrue, gives') +import Test.HUnit (test) +import Test.HUnit.DejaFu (testDejafu) -main :: IO () -main = void . runTestTT $ TestList - [ TestLabel "async" $ test +tests :: [Test] +tests = + [ testGroup "async" . hUnitTestToTests $ test [ testDejafu async_wait "async_wait" $ alwaysTrue (==Right value) , testDejafu async_waitCatch "async_waitCatch" $ alwaysTrue (\case Right (Right v) -> v == value; _ -> False) , testDejafu async_exwait "async_exwait" $ alwaysTrue (==Right (Just TestException)) @@ -26,7 +28,7 @@ main = void . runTestTT $ TestList , testDejafu async_poll2 "async_poll2" $ alwaysTrue (\case Right (Just (Right v)) -> v == value; _ -> False) ] - , TestLabel "withAsync" $ test + , testGroup "withAsync" . hUnitTestToTests $ test [ testDejafu withasync_waitCatch "withasync_waitCatch" $ alwaysTrue (\case Right (Right v) -> v == value; _ -> False) , testDejafu withasync_wait2 "withasync_wait2" $ alwaysTrue (\case Right (Left (Just ThreadKilled)) -> True; _ -> False) diff --git a/dejafu-tests/dejafu-tests.cabal b/dejafu-tests/dejafu-tests.cabal index 3dacb37..266a669 100644 --- a/dejafu-tests/dejafu-tests.cabal +++ b/dejafu-tests/dejafu-tests.cabal @@ -20,6 +20,7 @@ executable dejafu-tests main-is: Main.hs other-modules: Cases + , Cases.Async , Cases.SingleThreaded , Cases.MultiThreaded , Cases.Litmus diff --git a/dejafu/dejafu.cabal b/dejafu/dejafu.cabal index fffdc62..4b702fd 100755 --- a/dejafu/dejafu.cabal +++ b/dejafu/dejafu.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: dejafu -version: 0.5.1.1 +version: 0.5.1.2 synopsis: Systematic testing for Haskell concurrency. description: @@ -74,7 +74,7 @@ source-repository head source-repository this type: git location: https://github.com/barrucadu/dejafu.git - tag: dejafu-0.5.1.1 + tag: dejafu-0.5.1.2 library exposed-modules: Test.DejaFu @@ -94,7 +94,7 @@ library -- other-modules: -- other-extensions: build-depends: base >=4.8 && <5 - , concurrency ==1.1.0.* + , concurrency ==1.1.1.* , containers >=0.5 && <0.6 , deepseq >=1.1 && <2 , exceptions >=0.7 && <0.9 diff --git a/stack.yaml b/stack.yaml index 9ef31e7..f3233e0 100755 --- a/stack.yaml +++ b/stack.yaml @@ -1,7 +1,6 @@ flags: {} packages: -- async-dejafu - concurrency - dejafu - dejafu-tests