[commit: containers] master: Improve docs of mapKeys. (820efd4)
Ian Lynagh
igloo at earth.li
Thu Feb 23 01:14:44 CET 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/containers
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/820efd4e7c3b886ef3e601f16a6cfc66beac0f3e
>---------------------------------------------------------------
commit 820efd4e7c3b886ef3e601f16a6cfc66beac0f3e
Author: Milan Straka <fox at ucw.cz>
Date: Wed Nov 23 20:39:23 2011 +0100
Improve docs of mapKeys.
The problem found out when improving tests.
>---------------------------------------------------------------
Data/Map/Base.hs | 4 ++--
Data/Map/Strict.hs | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Data/Map/Base.hs b/Data/Map/Base.hs
index 1e1af57..a6ad669 100644
--- a/Data/Map/Base.hs
+++ b/Data/Map/Base.hs
@@ -1598,8 +1598,8 @@ mapAccumRWithKey f a (Bin sx kx x l r) =
-- @'mapKeys' f s@ is the map obtained by applying @f@ to each key of @s at .
--
-- The size of the result may be smaller if @f@ maps two or more distinct
--- keys to the same new key. In this case the value at the smallest of
--- these keys is retained.
+-- keys to the same new key. In this case the value at the greatest of the
+-- original keys is retained.
--
-- > mapKeys (+ 1) (fromList [(5,"a"), (3,"b")]) == fromList [(4, "b"), (6, "a")]
-- > mapKeys (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "c"
diff --git a/Data/Map/Strict.hs b/Data/Map/Strict.hs
index 47c934b..4a9b1de 100644
--- a/Data/Map/Strict.hs
+++ b/Data/Map/Strict.hs
@@ -978,8 +978,8 @@ mapAccumRWithKey f a (Bin sx kx x l r) =
-- @'mapKeys' f s@ is the map obtained by applying @f@ to each key of @s at .
--
-- The size of the result may be smaller if @f@ maps two or more distinct
--- keys to the same new key. In this case the value at the smallest of
--- these keys is retained.
+-- keys to the same new key. In this case the value at the greatest of
+-- the original keys is retained.
--
-- > mapKeys (+ 1) (fromList [(5,"a"), (3,"b")]) == fromList [(4, "b"), (6, "a")]
-- > mapKeys (\ _ -> 1) (fromList [(1,"b"), (2,"a"), (3,"d"), (4,"c")]) == singleton 1 "c"
More information about the Cvs-libraries
mailing list