int-multimap 0.3 → 0.3.1
raw patch · 3 files changed
+15/−1 lines, 3 filesdep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: containers
API changes (from Hackage documentation)
+ IntMultimap: foldlWithKey' :: (Int -> a -> b -> a) -> a -> IntMultimap b -> a
Files
- int-multimap.cabal +1/−1
- library/IntMultimap.hs +9/−0
- test/Main.hs +5/−0
int-multimap.cabal view
@@ -1,7 +1,7 @@ name: int-multimap version:- 0.3+ 0.3.1 synopsis: A data structure that associates each Int key with a set of values category:
library/IntMultimap.hs view
@@ -13,6 +13,9 @@ -- * Transformations map, + -- * Folds+ foldlWithKey',+ -- * Basic interface null, size,@@ -119,6 +122,12 @@ keys :: IntMultimap a -> [Int] keys (IntMultimap intMap) = A.keys intMap++{--------------------------------------------------------------------+ Fold+--------------------------------------------------------------------}+foldlWithKey' :: (Int -> a -> b -> a) -> a -> IntMultimap b -> a+foldlWithKey' f v (IntMultimap intMap) = A.foldlWithKey' (\a k set -> B.foldl' (f k) a set) v intMap {-------------------------------------------------------------------- Filter
test/Main.hs view
@@ -73,6 +73,11 @@ , testProperty "Mapping" $ \ (list :: [(Int, Int)]) -> (B.fromList $ map testFuncL list) === (B.fromList $ A.toList $ A.map testFunc $ A.fromList list)+ -- ,+ -- testProperty "foldl" $ \ (list :: [(Int, Int)], fun :: (Fun Int Int Int Int), zero :: Int) ->+ -- let intMap = A.fromList list+ -- f = applyFun fun+ -- in A.foldlWithKey' f zero intMap === zero ] testFunc :: (Show a) => a -> String