package bonsai

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

A simple data structure for keeping track of a focused element within a list. The focus wraps around so that calling prev when the focus is the head of the list will cause the focus to move to the end. There is always a focused element -- i.e. there is no blur operation.

type 'a t
include Ppx_compare_lib.Comparable.S1 with type 'a t := 'a t
val compare : 'a Base__Ppx_compare_lib.compare -> 'a t Base__Ppx_compare_lib.compare
include Ppx_compare_lib.Equal.S1 with type 'a t := 'a t
val equal : 'a Base__Ppx_compare_lib.equal -> 'a t Base__Ppx_compare_lib.equal
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 of_nonempty_list_exn : 'a list -> 'a t
val next : 'a t -> 'a t
val prev : 'a t -> 'a t
val current_focus : 'a t -> 'a
val set : 'a t -> f:('a -> bool) -> 'a t option

O(n). Find the first element matching f in the list, and make that the focus.

OCaml

Innovation. Community. Security.