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 -> 'a -> int) -> 'a t -> 'a t -> int
include Ppx_compare_lib.Equal.S1 with type 'a t := 'a t
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
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.