1
1
mirror of https://github.com/github/semantic.git synced 2025-01-09 00:56:32 +03:00

Add bimapJoin to simplify modifying Join by a bimap.

This commit is contained in:
Rob Rix 2016-03-24 14:20:28 -04:00
parent b2fce1abbd
commit 0429e14f36

View File

@ -146,6 +146,9 @@ groupChildrenByLine ranges children = go (fromThese [] [] $ runJoin ranges) chil
modifyJoin :: (p a a -> q b b) -> Join p a -> Join q b
modifyJoin f = Join . f . runJoin
bimapJoin :: Bifunctor p => (a -> b) -> (a -> b) -> Join p a -> Join p b
bimapJoin f g = modifyJoin $ bimap f g
intersects :: Range -> Range -> Bool
intersects a b = max (start a) (start b) < min (end a) (end b)