tree-diff: Diffing of (expression) trees.

[ data, gpl, library, testing ] [ Propose Tags ]

Common diff algorithm works on list structures:

diff :: Eq a => [a] -> [a] -> [Edit a]

This package works on trees.

treeDiff :: Eq a => Tree a -> Tree a -> Edit (EditTree a)

This package also provides a way to diff arbitrary ADTs, using Generics-derivable helpers.

This package differs from gdiff, in a two ways: tree-diff doesn't have patch function, and the "edit-script" is a tree itself, which is useful for pretty-printing.

>>> prettyEditExpr $ ediff (Foo 42 [True, False] "old") (Foo 42 [False, False, True] "new")
Foo
  {fooBool = [-True, +False, False, +True],
   fooInt = 42,
   fooString = -"old" +"new"}

[Skip to Readme]
Versions [RSS] [faq] 0, 0.0.0.1, 0.0.1, 0.0.2, 0.0.2.1, 0.1, 0.2, 0.2.1
Change log ChangeLog.md
Dependencies aeson (>=1.4.6.0 && <1.5 || >=1.5.6.0 && <1.6), ansi-terminal (>=0.10 && <0.12), ansi-wl-pprint (>=0.6.8.2 && <0.7), base (>=4.5 && <4.16), base-compat (>=0.10.5 && <0.11 || >=0.11.0 && <0.13), bytestring (>=0.9.2.1 && <0.10 || >=0.10.0.2 && <0.11 || >=0.11.0.0 && <0.12), bytestring-builder (>=0.10.8.2.0 && <0.11), containers (>=0.4.2.1 && <0.5 || >=0.5.0.0 && <0.6 || >=0.6.0.1 && <0.7), deepseq (>=1.3.0.0 && <1.4 || >=1.4.0.0 && <1.5), generic-deriving (>=1.13.1 && <1.15), ghc-prim, hashable (>=1.2.7.0 && <1.3 || >=1.3.0.0 && <1.4), nats (>=1.1.2 && <1.2), parsec (>=3.1.13.0 && <3.2), parsers (>=0.12.10 && <0.13), pretty (>=1.1.1.0 && <1.2), primitive (>=0.7.1.0 && <0.8), QuickCheck (>=2.14.2 && <2.15), scientific (>=0.3.6.2 && <0.4), semialign (>=1.1 && <1.3), semigroups (>=0.19.1 && <0.20), strict (>=0.4.0.1 && <0.5), tagged (>=0.8.6 && <0.9), text (>=1.2.3.0 && <1.3), these (>=1.1.1.1 && <1.2), time (==1.4.* || >=1.5.0.1 && <1.6 || >=1.6.0.1 && <1.7 || >=1.8.0.2 && <1.9 || >=1.9.3 && <1.10), transformers (>=0.3.0.0 && <0.4 || >=0.4.2.0 && <0.5 || >=0.5.2.0 && <0.6), unordered-containers (>=0.2.8.0 && <0.3), uuid-types (>=1.0.3 && <1.1), vector (==0.12.*), void (>=0.7.3 && <0.8) [details]
License GPL-2.0-or-later
Copyright (c) 2017-2021 Oleg Grenrus
Author Oleg Grenrus <oleg.grenrus@iki.fi>
Maintainer Oleg.Grenrus <oleg.grenrus@iki.fi>
Revised Revision 1 made by phadej at 2021-08-30T22:02:44Z
Category Data, Testing
Home page https://github.com/phadej/tree-diff
Bug tracker https://github.com/phadej/tree-diff/issues
Source repo head: git clone https://github.com/phadej/tree-diff.git
Uploaded by phadej at 2021-03-17T09:06:41Z
Distributions Arch:0.2, LTSHaskell:0.2, NixOS:0.2, Stackage:0.2.1
Downloads 13821 total (933 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2021-03-17 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Candidates


Readme for tree-diff-0.2

[back to package description]

tree-diff

Diffing of (expression) trees.

Examples

tree-diff displays pretty diffs of tree data:

Because of its untyped internal type, it copes with type changes:

As a bonus, multiline Strings and Text are diffed linewise: