data-ivar 0.1 → 0.11
raw patch · 2 files changed
+7/−7 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/IVar.hs +6/−6
- data-ivar.cabal +1/−1
Data/IVar.hs view
@@ -29,11 +29,11 @@ -- > main = do -- > iv <- IVar.new -- > iv' <- IVar.new--- > forkIO $ threadDelay 10000000 >> writeIVar iv' "my spoon is too big"+-- > forkIO $ threadDelay 10000000 >> IVar.write iv' "my spoon is too big" -- > let merger = IVar.read iv `mplus` IVar.read iv' -- > print =<< IVar.nonblocking merger -- most likely "Nothing" -- > print =<< IVar.blocking merger -- waits a while, then prints--- > writeIVar iv' "i am a banana" -- throws error "IVar written twice"+-- > IVar.write iv' "i am a banana" -- throws error "IVar written twice" module Data.IVar ( IVar, new, write, read@@ -62,7 +62,7 @@ new = IVar <$> newIORef (NoValue Map.empty) -- | Write a value to an IVar. If the IVar already has a value, --- throws an error "Attempt to write to an IVar twice".+-- throws an error \"Attempt to write to an IVar twice\". write :: IVar a -> a -> IO () write (IVar ref) x = do b <- atomicModifyIORef ref $ \v ->@@ -120,7 +120,7 @@ -- -- The MonadPlus and Monoid instances for Reader are equivalent. -- It tries the left action ; if it blocks, then it tries the--- right action ; if *it* blocks, then the whole action blocks+-- right action ; if /it/ blocks, then the whole action blocks -- until one of the two is available. newtype Reader a = Reader { runReader :: IO (Either a [LogEntry (Reader a)]) } @@ -160,8 +160,8 @@ mplus = mappend --- | Run a reader nonblocking. Returns Just x if a value x is--- available, Nothing otherwise.+-- | Run a reader nonblocking. Returns @Just x@ if a value @x@ is+-- available, @Nothing@ otherwise. nonblocking :: Reader a -> IO (Maybe a) nonblocking reader = do r <- runReader reader
data-ivar.cabal view
@@ -3,7 +3,7 @@ Write-once variables, with the ability to block on the first of a set of variables to become available.-Version: 0.1+Version: 0.11 Stability: experimental Synopsis: Write-once variables with concurrency support License: BSD3