Module Shistory (.ml)

module Shistory: sig .. end
Representing an history. There is always at least one element in the history, it cannot be empty.
Version: 1.0
History

type 'a t 
exception No_more
val create : 'a -> 'a t
create v creates an history with a first value v.
val push : 'a -> 'a t -> 'a t
val get : 'a t -> 'a
val undo : 'a t -> 'a * 'a t
Raises No_more if there is no value before the current one.
val redo : 'a t -> 'a * 'a t
Raises No_more if there is no value after the current one.
val can_redo : 'a t -> bool
val as_list : 'a t -> 'a list

Imperative interface


type 'a imp_t 
val imp_create : 'a -> 'a imp_t
val imp_push : 'a -> 'a imp_t -> unit
val imp_get : 'a imp_t -> 'a
val imp_undo : 'a imp_t -> 'a
val imp_redo : 'a imp_t -> 'a
val imp_can_redo : 'a imp_t -> bool
val imp_as_list : 'a imp_t -> 'a list
val imp_to_t : 'a imp_t -> 'a t
val t_to_imp : 'a t -> 'a imp_t