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

Replace rangeLists with a use of fromThese.

This commit is contained in:
Rob Rix 2016-03-24 11:34:11 -04:00
parent 4d99c94bc2
commit 6a0302acbf

View File

@ -131,9 +131,8 @@ 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 = go rangeLists children
where rangeLists = these (flip (,) []) ((,) []) (,) (runJoin ranges)
go ranges children | (l:ls, r:rs) <- ranges
groupChildrenByLine ranges children = go (fromThese [] [] $ runJoin ranges) children
where go ranges children | (l:ls, r:rs) <- ranges
, (child:rest) <- children
= go ranges rest
| otherwise = uncurry (alignWith (fmap (flip (,) []) . Join)) ranges