generic finger-tree structure (http://staff.city.ac.uk/~ross/papers/FingerTree.html)
#19IntervalMap missing methods
Great library! But it seems to be missing quite a lot of functionality that I'd like to use in anger. For example:
toList :: IntervalMap k a -> [(Interval k, a)]
greatestView :: Ord v => IntervalMap v a -> Maybe ((Interval v, a), IntervalMap v a)
partitionIntervals :: Ord v => (v -> Bool) -> IntervalMap v a -> (IntervalMap v a, IntervalMap v a)
-- law: forall p im. uncurry (<>) (partitionalIntervals p im) = im
partitionIntervals is quite interesting; since it allows us to generalize search, intersections and dominators to also return the complement of the selected intervalmap. Thus we can also get dominatees and nonintersections.
Example hacked up implementation:
I've added
assocs,fromListandgreatestView.Thinking about
partitionIntervals. One nice feature ofsearch, etc is that the list is produced lazily.