From 3366b94b5a56fb2544b4f449c0abafe84dd76566 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 25 Apr 2016 15:08:20 -0400 Subject: [PATCH] Simplify showLine a little further. --- test/AlignmentSpec.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/AlignmentSpec.hs b/test/AlignmentSpec.hs index 0175c7df3..bf17c581d 100644 --- a/test/AlignmentSpec.hs +++ b/test/AlignmentSpec.hs @@ -113,8 +113,7 @@ data PrettyDiff = PrettyDiff { unPrettySources :: Both (Source.Source Char), unP instance Show PrettyDiff where show (PrettyDiff sources lines) = showLine (fromMaybe 0 (maximum (fmap length <$> shownLines))) <$> catMaybes shownLines >>= ('\n':) where shownLines = toBoth <$> lines - showLine n line = let (before, after) = fromThese (replicate n ' ') (replicate n ' ') (runJoin (pad n <$> line)) in - before ++ " | " ++ after + showLine n line = uncurry ((++) . (++ " | ")) (fromThese (replicate n ' ') (replicate n ' ') (runJoin (pad n <$> line))) showDiff diff = filter (/= '\n') . toList . Source.slice (getRange diff) pad n string = showString (take n string) (replicate (max 0 (n - length string)) ' ') toBoth them = showDiff <$> them `applyThese` modifyJoin (uncurry These) sources