[commit: packages/containers] ghc-head: Annotate IntMap.fold*WithKey with correct Key synonym (341b817)

git at git.haskell.org git at git.haskell.org
Fri Aug 30 13:34:04 CEST 2013


Repository : ssh://git@git.haskell.org/containers

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/containers.git;a=commit;h=341b8172afe8237188766efa8a006d4946dbd229

>---------------------------------------------------------------

commit 341b8172afe8237188766efa8a006d4946dbd229
Author: Liyang HU <git at liyang.hu>
Date:   Tue Oct 2 10:29:45 2012 +0900

    Annotate IntMap.fold*WithKey with correct Key synonym


>---------------------------------------------------------------

341b8172afe8237188766efa8a006d4946dbd229
 Data/IntMap.hs      |    2 +-
 Data/IntMap/Base.hs |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Data/IntMap.hs b/Data/IntMap.hs
index e3e9eb1..5be3c13 100644
--- a/Data/IntMap.hs
+++ b/Data/IntMap.hs
@@ -90,6 +90,6 @@ fold = foldr
 -- /O(n)/. Fold the keys and values in the map using the given
 -- right-associative binary operator. This function is an equivalent
 -- of 'foldrWithKey' and is present for compatibility only.
-foldWithKey :: (Int -> a -> b -> b) -> b -> IntMap a -> b
+foldWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
 foldWithKey = foldrWithKey
 {-# INLINE foldWithKey #-}
diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs
index b3f8864..1bdfc1b 100644
--- a/Data/IntMap/Base.hs
+++ b/Data/IntMap/Base.hs
@@ -1619,7 +1619,7 @@ foldl' f z = \t ->      -- Use lambda t to be inlinable with two arguments only.
 --
 -- > let f k a result = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")"
 -- > foldrWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (5:a)(3:b)"
-foldrWithKey :: (Int -> a -> b -> b) -> b -> IntMap a -> b
+foldrWithKey :: (Key -> a -> b -> b) -> b -> IntMap a -> b
 foldrWithKey f z = \t ->      -- Use lambda t to be inlinable with two arguments only.
   case t of Bin _ m l r | m < 0 -> go (go z l) r -- put negative numbers before
                         | otherwise -> go (go z r) l
@@ -1633,7 +1633,7 @@ foldrWithKey f z = \t ->      -- Use lambda t to be inlinable with two arguments
 -- | /O(n)/. A strict version of 'foldrWithKey'. Each application of the operator is
 -- evaluated before using the result in the next application. This
 -- function is strict in the starting value.
-foldrWithKey' :: (Int -> a -> b -> b) -> b -> IntMap a -> b
+foldrWithKey' :: (Key -> a -> b -> b) -> b -> IntMap a -> b
 foldrWithKey' f z = \t ->      -- Use lambda t to be inlinable with two arguments only.
   case t of Bin _ m l r | m < 0 -> go (go z l) r -- put negative numbers before
                         | otherwise -> go (go z r) l
@@ -1655,7 +1655,7 @@ foldrWithKey' f z = \t ->      -- Use lambda t to be inlinable with two argument
 --
 -- > let f result k a = result ++ "(" ++ (show k) ++ ":" ++ a ++ ")"
 -- > foldlWithKey f "Map: " (fromList [(5,"a"), (3,"b")]) == "Map: (3:b)(5:a)"
-foldlWithKey :: (a -> Int -> b -> a) -> a -> IntMap b -> a
+foldlWithKey :: (a -> Key -> b -> a) -> a -> IntMap b -> a
 foldlWithKey f z = \t ->      -- Use lambda t to be inlinable with two arguments only.
   case t of Bin _ m l r | m < 0 -> go (go z r) l -- put negative numbers before
                         | otherwise -> go (go z l) r
@@ -1669,7 +1669,7 @@ foldlWithKey f z = \t ->      -- Use lambda t to be inlinable with two arguments
 -- | /O(n)/. A strict version of 'foldlWithKey'. Each application of the operator is
 -- evaluated before using the result in the next application. This
 -- function is strict in the starting value.
-foldlWithKey' :: (a -> Int -> b -> a) -> a -> IntMap b -> a
+foldlWithKey' :: (a -> Key -> b -> a) -> a -> IntMap b -> a
 foldlWithKey' f z = \t ->      -- Use lambda t to be inlinable with two arguments only.
   case t of Bin _ m l r | m < 0 -> go (go z r) l -- put negative numbers before
                         | otherwise -> go (go z l) r





More information about the ghc-commits mailing list