mirror of
https://github.com/barrucadu/dejafu.git
synced 2024-11-29 11:23:43 +03:00
Merge pull request #304 from barrucadu/newtvarconc
Add newTVarConc to MonadConc
This commit is contained in:
commit
1e016e09bb
@ -45,7 +45,7 @@ There are a few different packages under the Déjà Fu umbrella:
|
||||
|
||||
| | Version | Summary |
|
||||
| - | ------- | ------- |
|
||||
| [concurrency][h:conc] | 1.8.0.0 | Typeclasses, functions, and data types for concurrency and STM. |
|
||||
| [concurrency][h:conc] | 1.8.1.0 | Typeclasses, functions, and data types for concurrency and STM. |
|
||||
| [dejafu][h:dejafu] | 2.1.0.1 | Systematic testing for Haskell concurrency. |
|
||||
| [hunit-dejafu][h:hunit] | 2.0.0.1 | Deja Fu support for the HUnit test framework. |
|
||||
| [tasty-dejafu][h:tasty] | 2.0.0.1 | Deja Fu support for the Tasty test framework. |
|
||||
|
@ -7,6 +7,19 @@ standard Haskell versioning scheme.
|
||||
.. _PVP: https://pvp.haskell.org/
|
||||
|
||||
|
||||
1.8.1.0 (2019-11-16)
|
||||
====================
|
||||
|
||||
* Git: :tag:`concurrency-1.8.1.0`
|
||||
* Hackage: :hackage:`concurrency-1.8.1.0`
|
||||
|
||||
Added
|
||||
~~~~~
|
||||
|
||||
* (:issue:`303`) ``Control.Monad.Conc.Class.newTVarConc``, with a
|
||||
default implementation of ``atomically . newTVar``.
|
||||
|
||||
|
||||
1.8.0.0 (2019-10-04)
|
||||
--------------------
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
-- |
|
||||
-- Module : Control.Monad.Conc.Class
|
||||
-- Copyright : (c) 2016--2018 Michael Walker
|
||||
-- Copyright : (c) 2016--2019 Michael Walker
|
||||
-- License : MIT
|
||||
-- Maintainer : Michael Walker <mike@barrucadu.co.uk>
|
||||
-- Stability : experimental
|
||||
@ -97,7 +97,7 @@ import Control.Monad.Catch (MonadCatch, MonadMask,
|
||||
import qualified Control.Monad.Catch as Ca
|
||||
import Control.Monad.Fail (MonadFail(..))
|
||||
import Control.Monad.STM.Class (IsSTM, MonadSTM, TVar, fromIsSTM,
|
||||
readTVar)
|
||||
newTVar, readTVar)
|
||||
import Control.Monad.Trans.Control (MonadTransControl, StT, liftWith)
|
||||
import Data.Proxy (Proxy(..))
|
||||
|
||||
@ -472,6 +472,14 @@ class ( Monad m
|
||||
-- @since 1.0.0.0
|
||||
atomically :: STM m a -> m a
|
||||
|
||||
-- | Create a @TVar@. This may be implemented differently for speed.
|
||||
--
|
||||
-- > newTVarConc = atomically . newTVar
|
||||
--
|
||||
-- @since 1.8.1.0
|
||||
newTVarConc :: a -> m (TVar (STM m) a)
|
||||
newTVarConc = atomically . newTVar
|
||||
|
||||
-- | Read the current value stored in a @TVar@. This may be
|
||||
-- implemented differently for speed.
|
||||
--
|
||||
@ -774,6 +782,7 @@ instance MonadConc IO where
|
||||
casIORef = IO.casIORef
|
||||
modifyIORefCAS = IO.atomicModifyIORefCAS
|
||||
atomically = IO.atomically
|
||||
newTVarConc = IO.newTVarIO
|
||||
readTVarConc = IO.readTVarIO
|
||||
|
||||
-- | Label the current thread, if the given label is nonempty.
|
||||
@ -852,6 +861,7 @@ instance MonadConc m => MonadConc (IsConc m) where
|
||||
modifyIORefCAS r = toIsConc . modifyIORefCAS r
|
||||
modifyIORefCAS_ r = toIsConc . modifyIORefCAS_ r
|
||||
atomically = toIsConc . atomically . fromIsSTM
|
||||
newTVarConc = toIsConc . newTVarConc
|
||||
readTVarConc = toIsConc . readTVarConc
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@ -901,6 +911,7 @@ instance C => MonadConc (T m) where { \
|
||||
modifyIORefCAS r = lift . modifyIORefCAS r ; \
|
||||
modifyIORefCAS_ r = lift . modifyIORefCAS_ r ; \
|
||||
atomically = lift . atomically ; \
|
||||
newTVarConc = lift . newTVarConc ; \
|
||||
readTVarConc = lift . readTVarConc }
|
||||
|
||||
-- | New threads inherit the reader state of their parent, but do not
|
||||
|
@ -2,7 +2,7 @@
|
||||
-- documentation, see http://haskell.org/cabal/users-guide/
|
||||
|
||||
name: concurrency
|
||||
version: 1.8.0.0
|
||||
version: 1.8.1.0
|
||||
synopsis: Typeclasses, functions, and data types for concurrency and STM.
|
||||
|
||||
description:
|
||||
@ -32,7 +32,7 @@ source-repository head
|
||||
source-repository this
|
||||
type: git
|
||||
location: https://github.com/barrucadu/dejafu.git
|
||||
tag: concurrency-1.8.0.0
|
||||
tag: concurrency-1.8.1.0
|
||||
|
||||
library
|
||||
exposed-modules: Control.Monad.Conc.Class
|
||||
|
@ -27,7 +27,7 @@ There are a few different packages under the Déjà Fu umbrella:
|
||||
.. csv-table::
|
||||
:header: "Package", "Version", "Summary"
|
||||
|
||||
":hackage:`concurrency`", "1.8.0.0", "Typeclasses, functions, and data types for concurrency and STM"
|
||||
":hackage:`concurrency`", "1.8.1.0", "Typeclasses, functions, and data types for concurrency and STM"
|
||||
":hackage:`dejafu`", "2.1.0.1", "Systematic testing for Haskell concurrency"
|
||||
":hackage:`hunit-dejafu`", "2.0.0.1", "Déjà Fu support for the HUnit test framework"
|
||||
":hackage:`tasty-dejafu`", "2.0.0.1", "Déjà Fu support for the tasty test framework"
|
||||
|
Loading…
Reference in New Issue
Block a user