1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

Rename heads/tails to headRanges/tailRanges.

This commit is contained in:
Rob Rix 2016-03-29 13:53:46 -04:00
parent 55742ac947
commit 35d60f8517

View File

@ -132,14 +132,14 @@ alignDiff sources diff = iter alignSyntax (alignPatch sources <$> diff)
where lineRanges = runBothWith ((Join .) . These) (actualLineRanges <$> (characterRange <$> infos) <*> sources)
groupChildrenByLine :: Join These [Range] -> [AlignedDiff leaf] -> [Join These (Range, [SplitDiff leaf Info])]
groupChildrenByLine ranges children | Just (heads, tails) <- unconsThese ranges
, (intersectingChildren, rest) <- spanMergeable heads children
groupChildrenByLine ranges children | Just (headRanges, tailRanges) <- unconsThese ranges
, (intersectingChildren, rest) <- spanMergeable headRanges children
, ~(intersectingChildrenL, intersectingChildrenR) <- bimap catMaybes catMaybes (unalign $ runJoin <$> join intersectingChildren)
= (case runJoin heads of
= (case runJoin headRanges of
This l -> Join $ This (l, intersectingChildrenL)
That r -> Join $ That (r, intersectingChildrenR)
These l r -> Join $ These (l, intersectingChildrenL) (r, intersectingChildrenR))
: groupChildrenByLine tails rest
: groupChildrenByLine tailRanges rest
| otherwise = []
unconsThese :: Join These [a] -> Maybe (Join These a, Join These [a])