jinjor/elm-diff/1.0.3

NOTE: this package is not compatible with Elm 0.19.1

Diff

Compares two list and returns how they have changed. Each function internally uses Wu's O(NP) algorithm.

Types

type Change a
= Added a
| Removed a
| NoChange a

This describes how each line has changed and also contains its value.

Diffing

diff : List a -> List a -> List (Change a)

Compares general lists.

diff [1, 3] [2, 3] == [Removed 1, Added 2, NoChange 3] -- True
diffLines : String -> String -> List (Change String)

Compares two text.

Giving the following text

a = """aaa
bbb
ddd"""

b = """zzz
aaa
ccc
ddd"""

results in

[ Added "zzz"
, NoChange "aaa"
, Removed "bbb"
, Added "ccc"
, NoChange "ddd"
]

.