Up

Module Range

For handling diffs abstractly. A range is a subarray of the two original arrays with a constructor defining its relationship to the two original arrays. A Same range contains a series of elements which can be found in both arrays. A New range contains elements found only in the new array, while an Old range contains elements found only in the old array.

A Replace contains two arrays: elements in the first array are elements found only in the original, old array which have been replaced by elements in the second array, which are elements found only in the new array.

Signature

type 'a t =
| Same of ('a * 'a) array
| Old of 'a array
| New of 'a array
| Replace of 'a array * 'a array
| Unified of 'a array

ranges_all_same ranges returns true if all ranges are Same

val t_of_sexp : (Sexplib.Sexp.t -> 'a) -> Sexplib.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib.Sexp.t) -> 'a t -> Sexplib.Sexp.t
val all_same : 'a t list -> bool

ranges_all_same ranges returns true if all ranges are Same

val old_only : 'a t list -> 'a t list

old_only hunks drops all New ranges and converts all Replace ranges to Old ranges.

val new_only : 'a t list -> 'a t list

new_only hunks drops all Old ranges and converts all Replace ranges to New ranges.