Support.HistoryA history of items.
A history is a mutable data structure that keeps track of its "past" and "future". The history's state maintains its position in this sequence. A history supports moving back in time and forwards again as inverse operations.
Histories support appending new items. Doing so when having shifted into the past creates a new "timeline", dropping the old future.
val create : unit -> 'a tCreates an empty history.
val add : 'a t -> 'a -> unitRecords a new entry in the history. If the history is in the past, then the future items are deleted by this action, thus creating a new "timeline".
val step_forward : 'a t -> 'a optionstep_forward history steps the history forward, and yields history's future if it exists.
val step_backward : 'a t -> 'a optionstep_backward history steps the history backward, and yields history's past if it exists.
val to_lists : 'a t -> 'a list * 'a listConverts the history to a pair of lists. The first list represents the past items. The second list represents the future items. Both lists have the most recent item first.