Up

module History

: sig
#
type 'a t

History

A sort of zipper: maintains and synchronizes a list of different versions of an object (see ocamlmerlin.ml top comment).

#
val initial : 'a -> 'a t
#
val focused : 'a t -> 'a

Element to the left of the cursor (if last operation was an insertion, the inserted value is returned)

#
val head : 'a t -> 'a Std.List.non_empty
#
val tail : 'a t -> 'a list
#
val position : 'a t -> int
#
val seek_forward : ('a -> bool) -> 'a t -> 'a t

Move forward while item under cursor satisfy predicate

Move backward while item under cursor satisfy predicate

#
val seek_backward : ('a -> bool) -> 'a t -> 'a t
#
val move : int -> 'a t -> 'a t

Moves an arbitrary number of steps.

May stop earlier if it reaches an end of history.

#
val insert : 'a -> 'a t -> 'a t

Adds an element to the left of the cursor and drops the tail: insert w ..zyx|abc.. = ..zyxw|

#
val modify : ('a -> 'a) -> 'a t -> 'a t

Modifies focused element.

#
val append : ('a -> 'a) -> 'a t -> 'a t
#
val drop_tail : 'a t -> 'a t
#
val reconstruct : init:('a -> 'b) -> fold:('a -> 'b -> 'b) -> 'a t -> 'b t
#
val sync : strong_check:('a -> 'b -> bool) -> weak_check:('a -> 'b -> bool) -> init:('a -> 'b) -> strong_fold:('a -> 'b -> 'b) -> weak_update:('a -> 'b -> 'b) -> 'a t -> 'b t option -> 'b t * [
| `Nothing_done
| `Updated
]
end