packages feed

concurrency 1.0.0.0 → 1.1.0.0

raw patch · 2 files changed

+16/−18 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Control.Monad.Conc.Class: _concMessage :: (MonadConc m, Typeable a) => a -> m ()
+ Control.Monad.Conc.Class: tryReadMVar :: MonadConc m => MVar m a -> m (Maybe a)
- Control.Monad.Conc.Class: class (Applicative m, Monad m, MonadCatch m, MonadThrow m, MonadMask m, MonadSTM (STM m), Ord (ThreadId m), Show (ThreadId m)) => MonadConc m where type STM m :: * -> * type MVar m :: * -> * type CRef m :: * -> * type Ticket m :: * -> * type ThreadId m :: * fork ma = forkWithUnmask (\ _ -> ma) forkWithUnmask = forkWithUnmaskN "" forkWithUnmaskN _ = forkWithUnmask forkOn c ma = forkOnWithUnmask c (\ _ -> ma) forkOnWithUnmask = forkOnWithUnmaskN "" forkOnWithUnmaskN _ = forkOnWithUnmask threadDelay _ = yield newEmptyMVar = newEmptyMVarN "" newEmptyMVarN _ = newEmptyMVar newCRef = newCRefN "" newCRefN _ = newCRef readCRef cref = readForCAS cref >>= peekTicket atomicWriteCRef r a = atomicModifyCRef r $ const (a, ()) modifyCRefCAS_ cref f = modifyCRefCAS cref (\ a -> (f a, ())) readTVarConc = atomically . readTVar _concMessage _ = pure () where {
+ Control.Monad.Conc.Class: class (Applicative m, Monad m, MonadCatch m, MonadThrow m, MonadMask m, MonadSTM (STM m), Ord (ThreadId m), Show (ThreadId m)) => MonadConc m where type STM m :: * -> * type MVar m :: * -> * type CRef m :: * -> * type Ticket m :: * -> * type ThreadId m :: * fork ma = forkWithUnmask (\ _ -> ma) forkWithUnmask = forkWithUnmaskN "" forkWithUnmaskN _ = forkWithUnmask forkOn c ma = forkOnWithUnmask c (\ _ -> ma) forkOnWithUnmask = forkOnWithUnmaskN "" forkOnWithUnmaskN _ = forkOnWithUnmask threadDelay _ = yield newEmptyMVar = newEmptyMVarN "" newEmptyMVarN _ = newEmptyMVar newCRef = newCRefN "" newCRefN _ = newCRef readCRef cref = readForCAS cref >>= peekTicket atomicWriteCRef r a = atomicModifyCRef r $ const (a, ()) modifyCRefCAS_ cref f = modifyCRefCAS cref (\ a -> (f a, ())) readTVarConc = atomically . readTVar where {

Files

Control/Monad/Conc/Class.hs view
@@ -70,7 +70,6 @@ import Control.Monad.STM.Class (MonadSTM, TVar, readTVar) import Control.Monad.Trans.Control (MonadTransControl, StT, liftWith) import Data.Proxy (Proxy(..))-import Data.Typeable (Typeable)  -- for the 'IO' instance import qualified Control.Concurrent as IO@@ -115,6 +114,7 @@       , putMVar       , tryPutMVar       , readMVar+      , tryReadMVar       , takeMVar       , tryTakeMVar       , (newCRef | newCRefN)@@ -252,10 +252,16 @@   tryPutMVar :: MVar m a -> a -> m Bool    -- | Block until a value is present in the @MVar@, and then return-  -- it. As with 'readMVar', this does not \"remove\" the value,-  -- multiple reads are possible.+  -- it. This does not \"remove\" the value, multiple reads are+  -- possible.   readMVar :: MVar m a -> m a +  -- | Attempt to read a value from a @MVar@ non-blockingly, returning+  -- a 'Just' (and emptying the @MVar@) if there is something there,+  -- otherwise returning 'Nothing'. As with 'readMVar', this does not+  -- \"remove\" the value.+  tryReadMVar :: MVar m a -> m (Maybe a)+   -- | Take a value from a @MVar@. This \"empties\" the @MVar@,   -- allowing a new value to be put in. This will block if there is no   -- value in the @MVar@ already, until one has been put.@@ -346,14 +352,6 @@   -- had raised it with 'throw'. This can interrupt a blocked action.   throwTo :: Exception e => ThreadId m -> e -> m () -  -- | Does nothing.-  ---  -- During testing, records a message which shows up in the trace.-  ---  -- > _concMessage _ = pure ()-  _concMessage :: Typeable a => a -> m ()-  _concMessage _ = pure ()- ------------------------------------------------------------------------------- -- Utilities @@ -510,6 +508,7 @@   getNumCapabilities = IO.getNumCapabilities   setNumCapabilities = IO.setNumCapabilities   readMVar           = IO.readMVar+  tryReadMVar        = IO.tryReadMVar   myThreadId         = IO.myThreadId   yield              = IO.yield   threadDelay        = IO.threadDelay@@ -535,7 +534,7 @@ -- Transformer instances  #define INSTANCE(T,C,F)                                          \-instance C => MonadConc (T m) where                             { \+instance C => MonadConc (T m) where                            { \   type STM      (T m) = STM m                                  ; \   type MVar     (T m) = MVar m                                 ; \   type CRef     (T m) = CRef m                                 ; \@@ -559,6 +558,7 @@   newEmptyMVar       = lift newEmptyMVar                       ; \   newEmptyMVarN      = lift . newEmptyMVarN                    ; \   readMVar           = lift . readMVar                         ; \+  tryReadMVar        = lift . tryReadMVar                      ; \   putMVar v          = lift . putMVar v                        ; \   tryPutMVar v       = lift . tryPutMVar v                     ; \   takeMVar           = lift . takeMVar                         ; \@@ -574,9 +574,7 @@   casCRef r t        = lift . casCRef r t                      ; \   modifyCRefCAS r    = lift . modifyCRefCAS r                  ; \   atomically         = lift . atomically                       ; \-  readTVarConc       = lift . readTVarConc                     ; \-                                                                 \-  _concMessage    = lift . _concMessage                        }+  readTVarConc       = lift . readTVarConc                     }  -- | New threads inherit the reader state of their parent, but do not -- communicate results back.
concurrency.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                concurrency-version:             1.0.0.0+version:             1.1.0.0 synopsis:            Typeclasses, functions, and data types for concurrency and STM.  description:@@ -38,7 +38,7 @@   This used to be part of dejafu, but with the dejafu-0.4.0.0 release,   it was split out into its own package.   .-  == Why and not something else?+  == Why this and not something else?   .   * Why not base: like lifted-base, concurrency uses typeclasses to     make function types more generic. This automatically eliminates@@ -78,7 +78,7 @@ source-repository this   type:     git   location: https://github.com/barrucadu/dejafu.git-  tag:      concurrency-0.1.0.0+  tag:      concurrency-1.1.0.0  library   exposed-modules:     Control.Monad.Conc.Class