A diff consisting of disjoint Hunks.
ModuleDiff-2.0.1Haskell2010
Data.Algorithm.DiffContext
Generates a grouped diff with merged runs, and outputs them in the manner of diff -u.
- 3 types
- 7 values
- PackageDiff-2.0.1
- Exports10
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceDiffContext.hs
> let textA = ["a","b","c","d","e","f","g","h","i","j","k"]
> let textB = ["a","b","d","e","f","g","h","i","j"]
> let diff = getContextDiff (Just 2) textA textB
> prettyContextDiff (text "file1") (text "file2") (text . unnumber) diff
--- file1
+++ file2
@@ -1,5 +1,4 @@
a
b
-c
d
e
@@ -9,3 +8,2 @@
i
j
-kprettyContextDiff Pretty print a ContextDiff in the manner of diff -u.
prettyContextDiffOld :: DocDocument 1 name
-> DocDocument 2 name
-> (c -> Doc)Element pretty printer
-> ContextDiff c-> Doc
Pretty print without line numbers.
Create a diff of separate Hunks, each containing a sequence of differing elements surrounded by common elements for context.
The context size determines when to merge adjacent hunks:
two hunks are merged when the number of common elements between them does not
exceed twice the context size. Furthermore, if contextSize is Nothing
a single hunk with the whole diff is produced.
If for some reason you need the line numbers stripped from the result of getContextDiff for backwards compatibility.