Repository : ssh://darcs.haskell.org//srv/darcs/packages/containers

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/8e1d6bdb974b6cc56a4abc5781d0ec288d30ba96

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

commit 8e1d6bdb974b6cc56a4abc5781d0ec288d30ba96
Author: Milan Straka <[email protected]>
Date:   Sun Sep 11 15:26:24 2011 +0200

    Fix documentation copy-paste bugs.
    
    Fixes #5450.
    
    Also improve the documentation of fromListWith.

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

 Data/IntMap.hs |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Data/IntMap.hs b/Data/IntMap.hs
index b214d90..0f99452 100644
--- a/Data/IntMap.hs
+++ b/Data/IntMap.hs
@@ -1632,7 +1632,7 @@ fromList xs
 
 -- | /O(n*min(n,W))/. Create a map from a list of key\/value pairs with a 
combining function. See also 'fromAscListWith'.
 --
--- > fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == 
fromList [(3, "ab"), (5, "aba")]
+-- > fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"c")] == 
fromList [(3, "ab"), (5, "cba")]
 -- > fromListWith (++) [] == empty
 
 fromListWith :: (a -> a -> a) -> [(Key,a)] -> IntMap a 
@@ -1641,8 +1641,9 @@ fromListWith f xs
 
 -- | /O(n*min(n,W))/. Build a map from a list of key\/value pairs with a 
combining function. See also fromAscListWithKey'.
 --
--- > fromListWith (++) [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"a")] == 
fromList [(3, "ab"), (5, "aba")]
--- > fromListWith (++) [] == empty
+-- > let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ 
old_value
+-- > fromListWithKey f [(5,"a"), (5,"b"), (3,"b"), (3,"a"), (5,"c")] == 
fromList [(3, "3:a|b"), (5, "5:c|5:b|a")]
+-- > fromListWithKey f [] == empty
 
 fromListWithKey :: (Key -> a -> a -> a) -> [(Key,a)] -> IntMap a 
 fromListWithKey f xs 
@@ -1674,7 +1675,8 @@ fromAscListWith f xs
 -- the keys are in ascending order, with a combining function on equal keys.
 -- /The precondition (input list is ascending) is not checked./
 --
--- > fromAscListWith (++) [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), 
(5, "ba")]
+-- > let f key new_value old_value = (show key) ++ ":" ++ new_value ++ "|" ++ 
old_value
+-- > fromAscListWithKey f [(3,"b"), (5,"a"), (5,"b")] == fromList [(3, "b"), 
(5, "5:b|a")]
 
 fromAscListWithKey :: (Key -> a -> a -> a) -> [(Key,a)] -> IntMap a
 fromAscListWithKey _ []         = Nil



_______________________________________________
Cvs-libraries mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-libraries

Reply via email to