1

Consider we have a sequence of monoid elements, Data.Sequence is great for inserting, changing elements in certain positions.

I'm concerned with the following query, sum i j sequence, which returns the mconcat of all elements from position i to j. This can be done with by using a FingerTree with measure contain both the index and the mconcat result in O(log n) time.

Is there already a implementation of this in some Haskell library? Or do I have to implement Data.Sequence again with this ability with Data.FingerTree? (Sequence expose too little internal structure to do this effectively.)

Chao Xu
  • 2,156
  • 2
  • 22
  • 31
  • 2
    See [this answer for an idea of why Data.Sequence doesn't expose this functionality](http://stackoverflow.com/a/11154294/9859). – rampion Aug 10 '13 at 04:37

0 Answers0