Skip to content

Commit

Permalink
Test for inclusion.
Browse files Browse the repository at this point in the history
  • Loading branch information
robrix committed Jul 4, 2020
1 parent 3e113a3 commit 1aa0cff
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Data/IntervalSet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ insert :: Ord a => Interval I a -> IntervalSet a -> IntervalSet a
insert i = \case
Empty -> singleton i
Branch b l i' g
| sup i < inf i' -> Branch b' (insert i l) i' g
| inf i < sup i' -> Branch b' l i' (insert i g)
| otherwise -> merge b' l (i `union` i') g
| i `isSubintervalOf` i' -> Branch b l i' g
| sup i < inf i' -> Branch b' (insert i l) i' g
| inf i < sup i' -> Branch b' l i' (insert i g)
| otherwise -> merge b' l (i `union` i') g
where
b' = i `union` b

Expand Down

0 comments on commit 1aa0cff

Please sign in to comment.