generic finger-tree structure (http://staff.city.ac.uk/~ross/papers/FingerTree.html)

#2No Eq/Ord/Read/Show instances for IntervalMap or PriorityQueue?

IntervalMap and PriorityQueue don't have Eq, Ord, Read, or Show instances, and IntervalMap has no toList method that would make implementing such an instance possible. PriorityQueue could have a toList method hacked together with unfoldr minViewWithKey, but a native toList method would be much more efficient.

  • Both are Foldable, so use toList from Data.Foldable.

  • The toList from Foldable only gets the values, not their associated intervals.

  • added Eq, Ord and Show instances for these two. The instances for PriorityQueue use unfoldr minViewWithKey, because they have to be done in key order to be meaningful.

  • I have grave doubts about the Eq instance for priority queues. Do the other operations actually respect this equality? Which copy of a key we get, and therefore which value, when we extract the minimum is sensitive to tree balance. I don't think there's a really valid Eq instance available for this type. If you squint your eyes and don't care which values you get in which order, then I think you at least get a meaningful equivalence (not implemented by this instance), but it really doesn't feel like == to me.

  • Ugh... Please ignore my ignorant comment