1
1
mirror of https://github.com/github/semantic.git synced 2024-11-24 08:54:07 +03:00

Move showRow to the top level.

This commit is contained in:
Rob Rix 2015-12-30 15:27:04 -05:00
parent 636e526311
commit 2fc7d8f537

View File

@ -25,10 +25,12 @@ showHunk :: Eq a => (Source Char, Source Char) -> Hunk (SplitDiff a Info) -> Str
showHunk sources hunk = header hunk ++ concat (showChange sources <$> changes hunk)
showChange :: Eq a => (Source Char, Source Char) -> Change (SplitDiff a Info) -> String
showChange sources change = concat (showLine ' ' (snd sources) . unRight <$> context change) ++ concat (showRow <$> contents change)
where showRow (Row lineA lineB) = if lineA == lineB
then showLine ' ' (snd sources) lineB
else showLine '-' (fst sources) lineA ++ showLine '+' (snd sources) lineB
showChange sources change = concat (showLine ' ' (snd sources) . unRight <$> context change) ++ concat (showRow sources <$> contents change)
showRow :: Eq leaf => (Source Char, Source Char) -> Row (SplitDiff leaf Info) -> String
showRow sources (Row lineA lineB) = if lineA == lineB
then showLine ' ' (snd sources) lineB
else showLine '-' (fst sources) lineA ++ showLine '+' (snd sources) lineB
showLine :: Char -> Source Char -> Line (SplitDiff leaf Info) -> String
showLine _ _ EmptyLine = ""