Skip to content

Commit

Permalink
Fix possible bug in filterWithQueryInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeinsky committed Feb 8, 2023
1 parent 58cc540 commit 892ac00
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions rewindable-index/src/RewindableIndex/Storable.hs
Expand Up @@ -337,14 +337,7 @@ filterWithQueryInterval
-> [StorableEvent h]
-> [StorableEvent h]
filterWithQueryInterval QEverything es = es
filterWithQueryInterval (QInterval start end) es =
let es' = takeWhile (withPoint (\p -> p <= end)) es
in if not (null es') && withPoint (\p -> p >= start) (last es')
then es'
else []
where
withPoint :: (StorablePoint h -> Bool) -> StorableEvent h -> Bool
withPoint f e = let p = getPoint e in f p
filterWithQueryInterval (QInterval start end) es = takeWhile (\e -> getPoint e <= end) $ dropWhile (\e -> getPoint e < start) es

query
:: HasPoint (StorableEvent h) (StorablePoint h)
Expand Down

0 comments on commit 892ac00

Please sign in to comment.