package simple-diff

  1. Overview
  2. Docs
Simple_diff is a pure OCaml diffing algorithm.

Install

Dune Dependency

Authors

Maintainers

Sources

v0.2.1.tar.gz
sha256=316bc2619087e5989c0e2c7d93a223d4328f4696185d81ef8be6dffd578b0bfb
md5=3694fd83a00203bfb0ce861310643217

README.md.html

Simple Diff

Description

Simple Diff is a pure OCaml implementation of a diffing algorithm ported from https://github.com/paulgb/simplediff.

Usage

opam install simple-diff

It exposes only one function, get_diff, which expects two arrays of strings. These arrays of strings typically represent lines of a new and old versions of a file. The return value is a list of diffs. Below is an example of how to use:

open Simple_diff;;
let old = [| "foo"; "bar"; "baz"; "bin" |];;
let new = [| "bar"; "baz"; "foo"; "bin" |];;
get_diff old new;;
#=> [
  Deleted [| "foo"; "bar"; "baz" |];
  Added [| "bar"; "baz"; "foo" |];
  Equal [| "bin" |]
]
OCaml

Innovation. Community. Security.