This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Compute changes between strings
version 1.0.7
license BSD3
native-modules False
elm-version 0.17.0 <= v < 0.18.0
Tag 1.0.7
Committed At 2016-05-16 00:29:26 UTC
elm-lang/core 4.0.0 <= v < 5.0.0 4.0.5

Modules

README

Compares strings to produce change lists. diffChars and diffLines are provided.

The currently-implemented algorithm is the Hunt-McIlroy algorithm.

Pull requests optimizing the existing algorithm are welcome.

Pull requests implementing alternative diff algorithms (notably, the Patience algorithm) are also welcome.

import Diff (..)

diffChars "abc" "aBcd"
  -- [ NoChange "a", Changed "b" "B", NoChange "c", Added "d" ]


original = """Brian
Sohie
Oscar
Stella
Takis
"""

changed = """BRIAN
Stella
Frosty
Takis
"""

diffLines original changed
  -- [ Changed "Brian\nSohie\nOscar\n" "BRIAN\n"
  -- , NoChange "Stella\n"
  -- , Added "Frosty\n"
  -- , NoChange "Takis\n"
  -- ]

This package should still be considered unstable: while the returned list of changes will always be correct, the specific the list of changes and the way the changes are grouped/combined, as well as the performance characteristics of the diff algorithm may change in future releases of this package.