packages feed

stm-extras 0.1.0.2 → 0.1.0.3

raw patch · 3 files changed

+10/−5 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -2,3 +2,12 @@ [![Build Status](https://secure.travis-ci.org/louispan/stm-extras.png?branch=master)](http://travis-ci.org/louispan/stm-extras)  Extra STM functions+++# Changelog++* 0.1.0.0 ~ 0.1.0.2+ - Added forceSwapTMVar, waitTillEmptyTMVar, waitTillFullTMVar++* 0.1.0.3+ - Removed inline pragmas until I have actual benchmarks
src/Control/Concurrent/STM/TMVar/Extras.hs view
@@ -1,22 +1,18 @@ module Control.Concurrent.STM.TMVar.Extras where  import Control.Concurrent.STM-import Control.Concurrent.STM.TMVar  -- | Non-blocking swap of TMVar irreguardless if it previously contained a value or not. -- Returns what was in the TMVar (if exists) forceSwapTMVar :: TMVar a -> a -> STM (Maybe a) forceSwapTMVar v a = (Just <$> swapTMVar v a) `orElse` (const Nothing <$> putTMVar v a)-{-# INLINABLE forceSwapTMVar #-}  -- | Block until TMVar is empty. -- The argument a is used to try to put into TMVar, but is taken out again in the same -- transaction waitTillEmptyTMVar :: TMVar a -> a -> STM () waitTillEmptyTMVar v a = putTMVar v a >> takeTMVar v >> pure ()-{-# INLINABLE waitTillEmptyTMVar #-}  -- | Block until TMVar is full. waitTillFullTMVar :: TMVar a -> STM () waitTillFullTMVar v = takeTMVar v >>= putTMVar v-{-# INLINABLE waitTillFullTMVar #-}
stm-extras.cabal view
@@ -1,5 +1,5 @@ name:                stm-extras-version:             0.1.0.2+version:             0.1.0.3 synopsis:            Extra STM functions description:         Please see README.md homepage:            https://github.com/louispan/stm-extras#readme