package patience_diff

  1. Overview
  2. Docs

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 Next range contains elements found only in the second array, while an Prev range contains elements found only in the first array.

If a range is part of a move it will have a non-None Move_kind.t or Move_id.t in the case of Replace and Unified. A Prev with a Move _ Move_kind means that Prev has a corresponding Next that it was moved to. A Prev with a Within_move _ Move_kind means that this was some code that was deleted within a block that moved to a Next position of the file. If a Replace or Unified range is associated with a move it can only be change within a move so they only hove a Move_id.t option instead of a Move_kind.t option like Prev or Next.

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

type 'a t =
  1. | Same of ('a * 'a) array
include Sexplib0.Sexpable.S1 with type 'a t := 'a t
val t_of_sexp : (Sexplib0__.Sexp.t -> 'a) -> Sexplib0__.Sexp.t -> 'a t
val sexp_of_t : ('a -> Sexplib0__.Sexp.t) -> 'a t -> Sexplib0__.Sexp.t
val all_same : 'a t list -> bool

all_same ranges returns true if all ranges are Same

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

prev_only ranges drops all Next ranges and converts all Replace ranges to Prev ranges.

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

next_only ranges drops all Prev ranges and converts all Replace ranges to Next ranges.

val prev_size : 'a t -> int

Counts number of elements.

val next_size : 'a t -> int
module Stable : sig ... end
OCaml

Innovation. Community. Security.