stm-containers 1.0.0.1 → 1.0.1
raw patch · 6 files changed
+59/−9 lines, 6 filesdep +list-tdep ~stm-hamtPVP ok
version bump matches the API change (PVP)
Dependencies added: list-t
Dependency ranges changed: stm-hamt
API changes (from Hackage documentation)
+ StmContainers.Bimap: listT :: Bimap key value -> ListT STM (key, value)
+ StmContainers.Map: listT :: Map key value -> ListT STM (key, value)
+ StmContainers.Multimap: listT :: Multimap key value -> ListT STM (key, value)
+ StmContainers.Multimap: listTByKey :: (Eq key, Hashable key) => key -> Multimap key value -> ListT STM value
+ StmContainers.Multimap: listTKeys :: Multimap key value -> ListT STM key
+ StmContainers.Set: listT :: Set item -> ListT STM item
Files
- library/StmContainers/Bimap.hs +9/−1
- library/StmContainers/Map.hs +10/−2
- library/StmContainers/Multimap.hs +24/−3
- library/StmContainers/Prelude.hs +4/−0
- library/StmContainers/Set.hs +9/−1
- stm-containers.cabal +3/−2
library/StmContainers/Bimap.hs view
@@ -15,6 +15,7 @@ deleteRight, reset, unfoldM,+ listT, ) where @@ -156,10 +157,17 @@ A.reset rightMap -- |--- Stream associations.+-- 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++-- |+-- Stream the associations passively.+{-# INLINE listT #-}+listT :: Bimap key value -> ListT STM (key, value)+listT (Bimap leftMap _) =+ A.listT leftMap
library/StmContainers/Map.hs view
@@ -11,6 +11,7 @@ delete, reset, unfoldM,+ listT, ) where @@ -99,10 +100,17 @@ A.reset hamt -- |--- Stream the associations.+-- 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)+ fmap (\ (Product2 k v) -> (k, v)) (A.unfoldM hamt)++-- |+-- Stream the associations passively.+{-# INLINE listT #-}+listT :: Map key value -> ListT STM (key, value)+listT (Map hamt) =+ fmap (\ (Product2 k v) -> (k, v)) (A.listT hamt)
library/StmContainers/Multimap.hs view
@@ -14,6 +14,9 @@ unfoldM, unfoldMKeys, unfoldMByKey,+ listT,+ listTKeys,+ listTByKey, ) where @@ -137,7 +140,7 @@ A.reset map -- |--- Stream associations.+-- Stream associations actively. -- -- Amongst other features this function provides an interface to folding. unfoldM :: Multimap key value -> UnfoldM STM (key, value)@@ -145,13 +148,31 @@ A.unfoldM m >>= \(key, s) -> (key,) <$> B.unfoldM s -- |--- Stream keys.+-- Stream keys actively. unfoldMKeys :: Multimap key value -> UnfoldM STM key unfoldMKeys (Multimap m) = fmap fst (A.unfoldM m) -- |--- Stream values by a key.+-- Stream values by a key actively. unfoldMByKey :: (Eq key, Hashable key) => key -> Multimap key value -> UnfoldM STM value unfoldMByKey key (Multimap m) = lift (A.lookup key m) >>= maybe mempty B.unfoldM++-- |+-- Stream associations passively.+listT :: Multimap key value -> ListT STM (key, value)+listT (Multimap m) =+ A.listT m >>= \(key, s) -> (key,) <$> B.listT s++-- |+-- Stream keys passively.+listTKeys :: Multimap key value -> ListT STM key+listTKeys (Multimap m) =+ fmap fst (A.listT m)++-- |+-- Stream values by a key passively.+listTByKey :: (Eq key, Hashable key) => key -> Multimap key value -> ListT STM value+listTByKey key (Multimap m) =+ lift (A.lookup key m) >>= maybe mempty B.listT
library/StmContainers/Prelude.hs view
@@ -87,6 +87,10 @@ import DeferredFolds.Unfold as Exports (Unfold(..)) import DeferredFolds.UnfoldM as Exports (UnfoldM(..)) +-- list-t+-------------------------+import ListT as Exports (ListT(..))+ -- | Strict version of 'modifyTVar'. {-# INLINE modifyTVar' #-} modifyTVar' :: TVar a -> (a -> a) -> STM ()
library/StmContainers/Set.hs view
@@ -11,6 +11,7 @@ delete, reset, unfoldM,+ listT, ) where @@ -101,10 +102,17 @@ A.reset hamt -- |--- Stream elements.+-- 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++-- |+-- Stream the elements passively.+{-# INLINE listT #-}+listT :: Set item -> ListT STM item+listT (Set hamt) =+ A.listT hamt
stm-containers.cabal view
@@ -1,7 +1,7 @@ name: stm-containers version:- 1.0.0.1+ 1.0.1 synopsis: Containers for STM description:@@ -60,7 +60,8 @@ deferred-folds >=0.6.6 && <0.7, focus >=1 && <1.1, hashable <2,- stm-hamt >=1.1 && <1.2,+ list-t >=1.0.1 && <1.1,+ stm-hamt >=1.1.2 && <1.2, transformers >=0.5 && <0.6 test-suite test