Implement AnchoredSeq.splitAtMeasure
This PR implements a function that allows to split an AnchoredSeq at an arbitrary measure boundary.
It is helpful in the Genesis implementation to split AnchoredFragments. We need to count the amount of headers that a fragment contains in a window of slots (the genesis window). We currently do this with dropWhileNewest.
We use dropWhileNewest to cut the upper end of the fragment because we don't know the slot of the headers before or after the end of the window, which rules out splitBeforePoint, splitBeforeMeasure, etc.
Also tried filter to keep the headers in the window, but it was a bit slower than dropWhileNewest.
The implementation of splitAtMeasure provided here is at least as fast as dropWhileNewest in our measuring.
Alternatives
Expose a more general function split :: (v -> Bool) -> AnchoredSeq v a b -> AnchoredSeq v a b which delegates to FingerTree.split.
Or expose the implementation of AnchoredSeq, so we can implement this function in a "Utils" module without having to upgrade or fork ouroboros-network-api.
I will try to review this, but please bear with me as I need to analyze the code in context as well to make sense of it
Rebased master to resolve conflicts in a changelog.
Should I try merging at another time?