diff --git a/src/Unified.hs b/src/Unified.hs index 5a325c113..6e443fb71 100644 --- a/src/Unified.hs +++ b/src/Unified.hs @@ -23,9 +23,8 @@ unified diff before after = unifiedRange :: Range -> [(String, Maybe Range)] -> String -> String unifiedRange range children source = out ++ substring Range { start = previous, end = end range } after where (out, previous) = foldl accumulateContext ("", start range) children - accumulateContext (out, previous) (source, Just range) = (out ++ source, end range) - accumulateContext (out, previous) (source, _) = (out, previous) - + accumulateContext (out, previous) (child, Just range) = (out ++ substring Range { start = previous, end = start range } source ++ child, end range) + accumulateContext (out, previous) (child, _) = (out ++ child, previous) substring :: Range -> String -> String substring range = take (end range) . drop (start range)