
+1.
I'm somewhat leery of the interface change on #2, but I thnk consistency is
warranted and the burden of fixing it would only get worse with time.
-Edward Kmett
On Sun, Nov 1, 2009 at 5:00 PM, Twan van Laarhoven
The interfaces from Data.IntMap and Data.Map are subtly different. Here are two issues:
1. deleteMin/Max raise an exception on empty maps/set
Data.Map.deleteMax Data.Map.empty fromList [] Data.IntMap.deleteMax Data.IntMap.empty fromList *** Exception: deleteMax: empty map has no maximal element
Data.Set.deleteMin Data.Set.empty fromList [] Data.IntSet.deleteMin Data.IntSet.empty fromList *** Exception: deleteMin: empty set has no minimal element
Proposal: Data.IntMap/IntSet.deleteMin/Max should return empty when the input is empty.
2. findMin/Max have a different signature
Data.Map.findMin :: Map k a -> (k, a) Data.IntMap.findMin :: IntMap a -> a
The documentation of IntMap.findMin is also incorrect, it reads:
/O(log n)/ The minimal key of the map.
While it returns the value associated with the minimal key.
Proposal: Data.IntMap.findMin/findMax should have the type IntMap a -> (Key,a)
Twan _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries