stm-containers 1.0.1.1 → 1.1
raw patch · 7 files changed
+37/−36 lines, 7 filesdep ~deferred-foldsdep ~stm-hamtPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: deferred-folds, stm-hamt
API changes (from Hackage documentation)
- StmContainers.Bimap: unfoldM :: Bimap leftKey rightKey -> UnfoldM STM (leftKey, rightKey)
- StmContainers.Map: unfoldM :: Map key value -> UnfoldM STM (key, value)
- StmContainers.Multimap: unfoldM :: Multimap key value -> UnfoldM STM (key, value)
- StmContainers.Set: unfoldM :: Set item -> UnfoldM STM item
+ StmContainers.Bimap: unfoldlM :: Bimap leftKey rightKey -> UnfoldlM STM (leftKey, rightKey)
+ StmContainers.Map: unfoldlM :: Map key value -> UnfoldlM STM (key, value)
+ StmContainers.Multimap: unfoldlM :: Multimap key value -> UnfoldlM STM (key, value)
+ StmContainers.Set: unfoldlM :: Set item -> UnfoldlM STM item
- StmContainers.Multimap: unfoldMByKey :: (Eq key, Hashable key) => key -> Multimap key value -> UnfoldM STM value
+ StmContainers.Multimap: unfoldMByKey :: (Eq key, Hashable key) => key -> Multimap key value -> UnfoldlM STM value
- StmContainers.Multimap: unfoldMKeys :: Multimap key value -> UnfoldM STM key
+ StmContainers.Multimap: unfoldMKeys :: Multimap key value -> UnfoldlM STM key
Files
- library/StmContainers/Bimap.hs +5/−5
- library/StmContainers/Map.hs +11/−10
- library/StmContainers/Multimap.hs +8/−8
- library/StmContainers/Prelude.hs +2/−2
- library/StmContainers/Set.hs +5/−5
- stm-containers.cabal +3/−3
- test/Main/MapTests.hs +3/−3
library/StmContainers/Bimap.hs view
@@ -14,7 +14,7 @@ deleteLeft, deleteRight, reset,- unfoldM,+ unfoldlM, listT, ) where@@ -160,10 +160,10 @@ -- Stream associations actively. -- -- Amongst other features this function provides an interface to folding.-{-# INLINE unfoldM #-}-unfoldM :: Bimap leftKey rightKey -> UnfoldM STM (leftKey, rightKey)-unfoldM (Bimap leftMap rightMap) =- A.unfoldM leftMap+{-# INLINE unfoldlM #-}+unfoldlM :: Bimap leftKey rightKey -> UnfoldlM STM (leftKey, rightKey)+unfoldlM (Bimap leftMap rightMap) =+ A.unfoldlM leftMap -- | -- Stream the associations passively.
library/StmContainers/Map.hs view
@@ -10,20 +10,21 @@ insert, delete, reset,- unfoldM,+ unfoldlM, listT, ) where import StmContainers.Prelude hiding (insert, delete, lookup, alter, foldM, toList, empty, null)-import qualified StmHamt.SizedHamt as A+import qualified StmHamt.Hamt as A import qualified Focus as B+import qualified DeferredFolds.UnfoldlM as C -- | -- Hash-table, based on STM-specialized Hash Array Mapped Trie. newtype Map key value =- Map (A.SizedHamt (Product2 key value))+ Map (A.Hamt (Product2 key value)) -- | -- Construct a new map.@@ -53,8 +54,8 @@ -- Get the number of elements. {-# INLINABLE size #-} size :: Map key value -> STM Int-size (Map hamt) =- A.size hamt+size =+ C.foldlM' (\ x _ -> return (succ x)) 0 . unfoldlM -- | -- Focus on a value by the key.@@ -83,7 +84,7 @@ {-# INLINE insert #-} insert :: (Eq key, Hashable key) => value -> key -> Map key value -> STM () insert value key (Map hamt) =- A.insert (\(Product2 key _) -> key) (Product2 key value) hamt+ void (A.insert (\(Product2 key _) -> key) (Product2 key value) hamt) -- | -- Delete an item by a key.@@ -103,10 +104,10 @@ -- Stream the associations actively. -- -- Amongst other features this function provides an interface to folding.-{-# INLINABLE unfoldM #-}-unfoldM :: Map key value -> UnfoldM STM (key, value)-unfoldM (Map hamt) =- fmap (\ (Product2 k v) -> (k, v)) (A.unfoldM hamt)+{-# INLINABLE unfoldlM #-}+unfoldlM :: Map key value -> UnfoldlM STM (key, value)+unfoldlM (Map hamt) =+ fmap (\ (Product2 k v) -> (k, v)) (A.unfoldlM hamt) -- | -- Stream the associations passively.
library/StmContainers/Multimap.hs view
@@ -11,7 +11,7 @@ delete, deleteByKey, reset,- unfoldM,+ unfoldlM, unfoldMKeys, unfoldMByKey, listT,@@ -143,21 +143,21 @@ -- Stream associations actively. -- -- Amongst other features this function provides an interface to folding.-unfoldM :: Multimap key value -> UnfoldM STM (key, value)-unfoldM (Multimap m) =- A.unfoldM m >>= \(key, s) -> (key,) <$> B.unfoldM s+unfoldlM :: Multimap key value -> UnfoldlM STM (key, value)+unfoldlM (Multimap m) =+ A.unfoldlM m >>= \(key, s) -> (key,) <$> B.unfoldlM s -- | -- Stream keys actively.-unfoldMKeys :: Multimap key value -> UnfoldM STM key+unfoldMKeys :: Multimap key value -> UnfoldlM STM key unfoldMKeys (Multimap m) =- fmap fst (A.unfoldM m)+ fmap fst (A.unfoldlM m) -- | -- Stream values by a key actively.-unfoldMByKey :: (Eq key, Hashable key) => key -> Multimap key value -> UnfoldM STM value+unfoldMByKey :: (Eq key, Hashable key) => key -> Multimap key value -> UnfoldlM STM value unfoldMByKey key (Multimap m) =- lift (A.lookup key m) >>= maybe mempty B.unfoldM+ lift (A.lookup key m) >>= maybe mempty B.unfoldlM -- | -- Stream associations passively.
library/StmContainers/Prelude.hs view
@@ -84,8 +84,8 @@ -- deferred-folds --------------------------import DeferredFolds.Unfold as Exports (Unfold(..))-import DeferredFolds.UnfoldM as Exports (UnfoldM(..))+import DeferredFolds.Unfoldl as Exports (Unfoldl(..))+import DeferredFolds.UnfoldlM as Exports (UnfoldlM(..)) -- list-t -------------------------
library/StmContainers/Set.hs view
@@ -10,7 +10,7 @@ insert, delete, reset,- unfoldM,+ unfoldlM, listT, ) where@@ -105,10 +105,10 @@ -- Stream the elements actively. -- -- Amongst other features this function provides an interface to folding.-{-# INLINABLE unfoldM #-}-unfoldM :: Set item -> UnfoldM STM item-unfoldM (Set hamt) =- A.unfoldM hamt+{-# INLINABLE unfoldlM #-}+unfoldlM :: Set item -> UnfoldlM STM item+unfoldlM (Set hamt) =+ A.unfoldlM hamt -- | -- Stream the elements passively.
stm-containers.cabal view
@@ -1,5 +1,5 @@ name: stm-containers-version: 1.0.1.1+version: 1.1 synopsis: Containers for STM description: This library is based on an STM-specialized implementation of@@ -40,11 +40,11 @@ StmContainers.Prelude build-depends: base >=4.9 && <5,- deferred-folds >=0.6.6 && <0.7,+ deferred-folds >=0.7 && <0.8, focus >=1 && <1.1, hashable <2, list-t >=1.0.1 && <1.1,- stm-hamt >=1.1.2.1 && <1.2,+ stm-hamt >=1.2 && <1.3, transformers >=0.5 && <0.6 test-suite test
test/Main/MapTests.hs view
@@ -9,7 +9,7 @@ import qualified StmContainers.Map as StmMap import qualified Focus import qualified Data.HashMap.Strict as HashMap-import qualified DeferredFolds.UnfoldM as UnfoldM+import qualified DeferredFolds.UnfoldlM as UnfoldlM import qualified Control.Foldl as Foldl @@ -35,7 +35,7 @@ Just a -> HashMap.insert k (f a) m stmMapToHashMap :: (Hashable k, Eq k) => StmMap.Map k v -> STM (HashMap.HashMap k v)-stmMapToHashMap = UnfoldM.foldM (Foldl.generalize Foldl.hashMap) . StmMap.unfoldM+stmMapToHashMap = UnfoldlM.foldM (Foldl.generalize Foldl.hashMap) . StmMap.unfoldlM stmMapFromList :: (Hashable k, Eq k) => [(k, v)] -> STM (StmMap.Map k v) stmMapFromList list = do@@ -44,7 +44,7 @@ return m stmMapToList :: StmMap.Map k v -> STM [(k, v)]-stmMapToList = UnfoldM.foldM (Foldl.generalize Foldl.list) . StmMap.unfoldM+stmMapToList = UnfoldlM.foldM (Foldl.generalize Foldl.list) . StmMap.unfoldlM interpretStmMapUpdateAsHashMap :: (Hashable k, Eq k) => Update.Update k v -> HashMap.HashMap k v interpretStmMapUpdateAsHashMap =