Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- type Diff a = PolyDiff a a
- data PolyDiff a b
- getTextDiff :: Text -> Text -> Vector (Diff Text)
- getStringDiff :: String -> String -> [Diff Char]
- getGroupedStringDiff :: String -> String -> [Diff String]
- getVectorDiff :: Eq a => Vector a -> Vector a -> Vector (Diff a)
- getGroupedVectorDiff :: Eq a => Vector a -> Vector a -> Vector (Diff (Vector a))
- getVectorDiffBy :: forall a b. (a -> b -> Bool) -> Vector a -> Vector b -> Vector (PolyDiff a b)
- getGroupedVectorDiffBy :: forall a b. (a -> b -> Bool) -> Vector a -> Vector b -> Vector (PolyDiff (Vector a) (Vector b))
- data Edit
- getEditScript :: forall a. Eq a => Vector a -> Vector a -> Vector Edit
- getEditScriptBy :: forall a b. (a -> b -> Bool) -> Vector a -> Vector b -> Vector Edit
- computeDiffFromEditScript :: Vector a -> Vector b -> Vector Edit -> Vector (PolyDiff a b)
- computeGroupedDiffFromEditScript :: Vector a -> Vector b -> Vector Edit -> Vector (PolyDiff (Vector a) (Vector b))
- getDiff :: Eq a => [a] -> [a] -> [Diff a]
- getDiffBy :: (a -> b -> Bool) -> [a] -> [b] -> [PolyDiff a b]
- getGroupedDiff :: Eq a => [a] -> [a] -> [Diff [a]]
- getGroupedDiffBy :: (a -> b -> Bool) -> [a] -> [b] -> [PolyDiff [a] [b]]
Diffing
A value is either from the First
list, the Second
or from Both
.
Both
contains both the left and right values, in case you are using a form
of equality that doesn't check all data (for example, if you are using a
newtype to only perform equality on side of a tuple).
getTextDiff :: Text -> Text -> Vector (Diff Text) Source #
Text diff
Uses pack and unpack, so does not roundtrip.
It uses pack and unpack because Text
is not the same as Vector Char
;
You can't index a text in O(1) time, it takes O(n) time.
getStringDiff :: String -> String -> [Diff Char] Source #
String
diff
You probably want to use getTextDiff
with packed strings instead, but this
function doesn't have the roundtripping problem that getTextDiff
has.
getGroupedStringDiff :: String -> String -> [Diff String] Source #
Grouped String
diff
Like getStringDiff
but with entire strings instead of individual characters.
getVectorDiff :: Eq a => Vector a -> Vector a -> Vector (Diff a) Source #
Diff two vectors
Prefer getGroupedVectorDiff
for performance reasons.
getGroupedVectorDiff :: Eq a => Vector a -> Vector a -> Vector (Diff (Vector a)) Source #
Diff two vectors with grouped results
getVectorDiffBy :: forall a b. (a -> b -> Bool) -> Vector a -> Vector b -> Vector (PolyDiff a b) Source #
Diff two vectors with different types using a custom equality operator
Prefer getGroupedVectorDiffBy
for performance reasons.
getGroupedVectorDiffBy :: forall a b. (a -> b -> Bool) -> Vector a -> Vector b -> Vector (PolyDiff (Vector a) (Vector b)) Source #
Diff two vectors with grouped results using a custom equality operator
Internals
getEditScript :: forall a. Eq a => Vector a -> Vector a -> Vector Edit Source #
Compute the edit script to turn a given vector into the second given vector
getEditScriptBy :: forall a b. (a -> b -> Bool) -> Vector a -> Vector b -> Vector Edit Source #
Compute the edit script to turn a given vector into the second given vector with a custom equality operator
computeDiffFromEditScript :: Vector a -> Vector b -> Vector Edit -> Vector (PolyDiff a b) Source #
Compute a diff using an edit script.
Prefer computeGroupedDiffFromEditScript
for performance reasons.
computeGroupedDiffFromEditScript :: Vector a -> Vector b -> Vector Edit -> Vector (PolyDiff (Vector a) (Vector b)) Source #
Compute a diff using an edit script.
Prefer computeGroupedDiffFromEditScript
for performance reasons.
Backwards compatibility with Diff
getDiff :: Eq a => [a] -> [a] -> [Diff a] Source #
For backward compatibility with Diff
, use more specific functions if you can.
getDiffBy :: (a -> b -> Bool) -> [a] -> [b] -> [PolyDiff a b] Source #
For backward compatibility with Diff
, use more specific functions if you can.