1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Add a convenience to modify the contents of a Join.

This commit is contained in:
Rob Rix 2016-03-24 13:59:49 -04:00
parent ea97b04032
commit d118070186

View File

@ -143,6 +143,9 @@ groupChildrenByLine ranges children = go (fromThese [] [] $ runJoin ranges) chil
getRange (Free (Annotated (Info range _) _)) = range getRange (Free (Annotated (Info range _) _)) = range
getRange (Pure patch) | Info range _ :< _ <- getSplitTerm patch = range getRange (Pure patch) | Info range _ :< _ <- getSplitTerm patch = range
modifyJoin :: (p a a -> p b b) -> Join p a -> Join p b
modifyJoin f = Join . f . runJoin
intersects :: Range -> Range -> Bool intersects :: Range -> Range -> Bool
intersects a b = max (start a) (start b) < min (end a) (end b) intersects a b = max (start a) (start b) < min (end a) (end b)