1
1
mirror of https://github.com/github/semantic.git synced 2024-12-01 00:33:59 +03:00

Use applyToBoth to eliminate a fromJust.

This commit is contained in:
Rob Rix 2016-05-27 10:23:38 -04:00
parent 5dd24a96ea
commit 6b211ac8bb

View File

@ -158,7 +158,7 @@ alignBranch getRange children ranges = case intersectingChildren of
Just headRanges = headRangesOf ranges
(leftRange, rightRange) = splitThese headRanges
lineAndRemaining children ranges = let (intersections, remaining) = alignChildren getRange children ranges in
(fromJust ((,) <$> ranges `applyThese` Join (runBothWith These intersections)), remaining)
((,) <$> ranges `applyToBoth` intersections, remaining)
lineAndRemainingWhere predicate children = if any predicate children then Just . lineAndRemaining (filter predicate children) else const Nothing
advancePast :: [Join These term] -> ([a] -> [a], [a] -> [a])