<div>Yo,</div><div> </div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

 * I&#39;m not comfortable with having two redundant modules, one for Min- <span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">and one for MaxQueue. It is possible to implement both in the same data structure and still get type errors when e.g. &#39;union&#39; on a Min- and a MaxQueue (I did that in [1], please have a look at the latest version). My solution needs type families, which would not be good for containers, but I&#39;m pretty sure there&#39;s a containers-compatible solution.</span></blockquote>

<div><br></div><div>I&#39;m pretty sure there won&#39;t be a containers-compatible solution, certainly not a solution compatible with the style of containers as it&#39;s currently written, because your solution depends on exporting functionality with type classes.  If we&#39;re going to change that style in containers, it should be done all at once, in a complete rewrite.  Whether or not priority queues get added to containers, I&#39;m at least going to keep the style *consistent* with containers.  </div>

<div><br></div><div>With regards to benchmarks, we examined a comparison with leftist heaps earlier.  The biggest complaint is the O(log n) insert time, which is really kind of icky.  Here was Milan&#39;s conclusion:</div>

<div><br></div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

LeftistByMilan is actually pretty good for small inputs (up to ~ 2<sup><span class="Apple-style-span" style="font-size: small;">16</span></sup>), and the implementation is super-trivial compared to Binomial. But when the list gets bigger, the complexity gets worse. I think this is beause of O(log N) inserts -- the Binomial implementation with O(1) amortized inserts allocates much less memory and does not need to run a GC.  I vote for current (v5) Binomial implementation, even if the O(1) amortized inserts works only non-persistently (ie. under heavy persistent usage, leftist heaps might be a _little_ better).</blockquote>

<div><br></div><div>Furthermore, I added your implementation to the benchmarks that we&#39;d been using previously, which was essentially a full heapsort, rather than just searching for the five smallest elements as in your quickie benchmark.  By this comparison, your implementation is moderately <a href="http://code.haskell.org/containers-pqueue/bench-chart.pdf">slower</a>.   (The source code and data for this benchmark version are now in the <a href="http://code.haskell.org/containers-pqueue">code.haskell.org/containers-pqueue</a> directory.)</div>

<div><br></div><div>Though your implementation might be faster for some particular cases of problems, I think this is a fair comparison overall, and I&#39;m definitely not willing to accept leftist heaps&#39; O(log n) insert time given the slower overall performance for heapsort.</div>

<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

<span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">This is what the Haskell Platform is for.  No real need to add more<br>stuff to containers; if anything, the libraries stored there should be<br>

decoupled so that e.g. the recent Data.Map proposals wouldn&#39;t disturb<br>programs not using Data.Map.<br></span></blockquote><div><br></div><div>Again, my preference is to add pqueues to containers, and then if containers gets decoupled, then so will priority queues.  If I&#39;m going to split off a separate package for priority queues, it&#39;ll be because I&#39;ve been convinced that it ought to be separated from containers, period -- not just because people think containers should be broken up, and this is a good place to start.  Meh.</div>

<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br clear="all"></span></font>Louis Wasserman<br><a href="mailto:wasserman.louis@gmail.com">wasserman.louis@gmail.com</a><br>

<a href="http://profiles.google.com/wasserman.louis">http://profiles.google.com/wasserman.louis</a><br><br></div>