<div>+1.</div>
<div> </div>
<div>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.</div>
<div> </div>
<div>-Edward Kmett<br><br></div>
<div class="gmail_quote">On Sun, Nov 1, 2009 at 5:00 PM, Twan van Laarhoven <span dir="ltr"><<a href="mailto:twanvl@gmail.com">twanvl@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">The interfaces from Data.IntMap and Data.Map are subtly different. Here are two issues:<br><br><br>1. deleteMin/Max raise an exception on empty maps/set<br>
<br> > Data.Map.deleteMax Data.Map.empty<br> fromList []<br> > Data.IntMap.deleteMax Data.IntMap.empty<br> fromList *** Exception: deleteMax: empty map has no maximal element<br><br> > Data.Set.deleteMin Data.Set.empty<br>
fromList []<br> > Data.IntSet.deleteMin Data.IntSet.empty<br> fromList *** Exception: deleteMin: empty set has no minimal element<br><br>Proposal: Data.IntMap/IntSet.deleteMin/Max should return empty when the input is empty.<br>
<br><br>2. findMin/Max have a different signature<br><br> Data.Map.findMin :: Map k a -> (k, a)<br> Data.IntMap.findMin :: IntMap a -> a<br><br>The documentation of IntMap.findMin is also incorrect, it reads:<br>
<br> /O(log n)/ The minimal key of the map.<br><br>While it returns the value associated with the minimal key.<br><br>Proposal: Data.IntMap.findMin/findMax should have the type IntMap a -> (Key,a)<br><br><br><br>Twan<br>
_______________________________________________<br>Libraries mailing list<br><a href="mailto:Libraries@haskell.org" target="_blank">Libraries@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</blockquote></div><br>