diff -package:base-compat

This lets you use a difference list of a Semigroup as a Monoid.

Examples

>>> let hello = diff "Hello, "
>>> appEndo hello "World!"
"Hello, World!"
>>> appEndo (hello <> mempty) "World!"
"Hello, World!"
>>> appEndo (mempty <> hello) "World!"
"Hello, World!"
>>> let world = diff "World"

>>> let excl = diff "!"
>>> appEndo (hello <> (world <> excl)) mempty
"Hello, World!"
>>> appEndo ((hello <> world) <> excl) mempty
"Hello, World!"
Fails the test and shows a git-like diff if the comparison operation evaluates to False when applied to its arguments. The comparison function is the second argument, which may be counter-intuitive to Haskell programmers. However, it allows operators to be written infix for easy reading:
diff y (<) 87
diff x (<=) r
This function behaves like the unix diff tool, which gives a 0 exit code if the compared files are identical, or a 1 exit code code otherwise. Like unix diff, if the arguments fail the comparison, a /diff is shown.
This lets you use a difference list of a Semigroup as a Monoid.

Examples

let hello = diff "Hello, "
>>> appEndo hello "World!"
"Hello, World!"
>>> appEndo (hello <> mempty) "World!"
"Hello, World!"
>>> appEndo (mempty <> hello) "World!"
"Hello, World!"
let world = diff "World"
let excl = diff "!"
>>> appEndo (hello <> (world <> excl)) mempty
"Hello, World!"
>>> appEndo ((hello <> world) <> excl) mempty
"Hello, World!"
Display a time span as one time relative to another. Input is assumed to be seconds. Typical inputs are NominalDiffTime and DiffTime.
This lets you use a difference list of a Semigroup as a Monoid.

Example:

>>> let hello = diff "Hello, "

>>> appEndo hello "World!"
"Hello, World!"

>>> appEndo (hello <> mempty) "World!"
"Hello, World!"

>>> appEndo (mempty <> hello) "World!"
"Hello, World!"

>>> let world = diff "World"

>>> let excl = diff "!"

>>> appEndo (hello <> (world <> excl)) mempty
"Hello, World!"

>>> appEndo ((hello <> world) <> excl) mempty
"Hello, World!"
Render the difference between two expressions
The diff function calculates the first derivative of a scalar-to-scalar function by forward-mode AD
>>> diff sin 0
1.0
The diff function calculates the first derivative of a scalar-to-scalar function by forward-mode AD
>>> diff sin 0
1.0
Compute the derivative of a function.
>>> diff sin 0
1.0
>>> cos 0
1.0
Compute the derivative of a function.
>>> diff sin 0
1.0
>>> cos 0
1.0
Compute the derivative of a function.
>>> diff sin 0
1.0
Compute the derivative of a function.
>>> diff sin 0
1.0
The diff function calculates the first derivative of a scalar-to-scalar function by forward-mode AD
>>> diff sin 0
1.0
The diff function calculates the first derivative of a scalar-to-scalar function by forward-mode AD
>>> diff sin 0
1.0
Compute the derivative of a function.
>>> diff sin 0
1.0
>>> cos 0
1.0
Compute the derivative of a function.
>>> diff sin 0
1.0
>>> cos 0
1.0
Compute the derivative of a function.
>>> diff sin 0
1.0
>>> cos 0
1.0
Compute the first derivative of a function (a -> a)
Compute the first derivative of a function (a -> a)
Compare two JSON documents and generate a patch describing the differences. Uses the defaultConfig.
Return a unified diff of two revisions of a named resource. Format of the diff is a list [(Diff, [String])], where DI is F (in first document only), S (in second only), or B (in both), and the list is a list of lines (without newlines at the end).
Merge two JSON values and annotate the result with the differences.
The diff command.