[commit: containers] master: Unify IntMap.deleteFind{Min, Max} with the Map ... (0bead51)
Paolo Capriotti
p.capriotti at gmail.com
Tue May 8 00:55:03 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/containers
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/0bead5148215b68993952d9173983cdc83135e1a
>---------------------------------------------------------------
commit 0bead5148215b68993952d9173983cdc83135e1a
Author: Milan Straka <fox at ucw.cz>
Date: Mon Dec 5 22:33:18 2011 +0100
Unify IntMap.deleteFind{Min,Max} with the Map ...
... counterparts.
The type signature has changed from
IntMap.deleteFind{Min,Max} :: IntMap a -> (a, IntMap a)
to
IntMap.deleteFind{Min,Max} :: IntMap a -> ((Key, a), IntMap a)
.
>---------------------------------------------------------------
Data/IntMap/Base.hs | 8 ++++----
tests/intmap-properties.hs | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Data/IntMap/Base.hs b/Data/IntMap/Base.hs
index 0ca3480..08752da 100644
--- a/Data/IntMap/Base.hs
+++ b/Data/IntMap/Base.hs
@@ -955,12 +955,12 @@ minView :: IntMap a -> Maybe (a, IntMap a)
minView t = liftM (first snd) (minViewWithKey t)
-- | /O(log n)/. Delete and find the maximal element.
-deleteFindMax :: IntMap a -> (a, IntMap a)
-deleteFindMax = fromMaybe (error "deleteFindMax: empty map has no maximal element") . maxView
+deleteFindMax :: IntMap a -> ((Key, a), IntMap a)
+deleteFindMax = fromMaybe (error "deleteFindMax: empty map has no maximal element") . maxViewWithKey
-- | /O(log n)/. Delete and find the minimal element.
-deleteFindMin :: IntMap a -> (a, IntMap a)
-deleteFindMin = fromMaybe (error "deleteFindMin: empty map has no minimal element") . minView
+deleteFindMin :: IntMap a -> ((Key, a), IntMap a)
+deleteFindMin = fromMaybe (error "deleteFindMin: empty map has no minimal element") . minViewWithKey
-- | /O(log n)/. The minimal key of the map.
findMin :: IntMap a -> (Key, a)
diff --git a/tests/intmap-properties.hs b/tests/intmap-properties.hs
index 93d9eb9..9fadf9d 100644
--- a/tests/intmap-properties.hs
+++ b/tests/intmap-properties.hs
@@ -622,10 +622,10 @@ test_deleteMax = do
deleteMin (empty :: SMap) @?= empty
test_deleteFindMin :: Assertion
-test_deleteFindMin = deleteFindMin (fromList [(5,"a"), (3,"b"), (10,"c")]) @?= ("b", fromList[(5,"a"), (10,"c")])
+test_deleteFindMin = deleteFindMin (fromList [(5,"a"), (3,"b"), (10,"c")]) @?= ((3,"b"), fromList[(5,"a"), (10,"c")])
test_deleteFindMax :: Assertion
-test_deleteFindMax = deleteFindMax (fromList [(5,"a"), (3,"b"), (10,"c")]) @?= ("c", fromList [(3,"b"), (5,"a")])
+test_deleteFindMax = deleteFindMax (fromList [(5,"a"), (3,"b"), (10,"c")]) @?= ((10,"c"), fromList [(3,"b"), (5,"a")])
test_updateMin :: Assertion
test_updateMin = do
More information about the Cvs-libraries
mailing list