package bonsai

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
val of_incr : ('result, 'incr) Incremental.t -> (_, 'result, 'incr, _) t

Constructs a bonsai component whose result is always the same as this Incremental node.

val pure : f:(('input, 'incr) Incremental.t -> ('result, 'incr) Incremental.t) -> ('input, 'result, 'incr, _) t

Same as Bonsai.pure but allows the user to optimize using Incremental.

val leaf : (module Bonsai_types.Model with type t = 'model) -> (module Bonsai_types.Action with type t = 'action) -> name:string -> default_model:'model -> apply_action: (('input, 'incr) Incremental.t -> ('model, 'incr) Incremental.t -> inject:('action -> 'event) -> (schedule_event:('event -> unit) -> 'action -> 'model, 'incr) Incremental.t) -> compute: (('input, 'incr) Incremental.t -> ('model, 'incr) Incremental.t -> inject:('action -> 'event) -> ('result, 'incr) Incremental.t) -> ('input, 'result, 'incr, 'event) t

Same as Bonsai.leaf, but incremental

val model_cutoff : ('input, 'result, 'incr, 'event) t -> ('input, 'result, 'incr, 'event) t

Creates a bonsai component where the given cutoff is applied to the incremental node for the component's model, preventing a component from being recalculated unnecessarily.

See Incr.set_cutoff.

val value_cutoff : cutoff:'input Incremental.Cutoff.t -> ('input, 'input, _, _) t

An identity component, except that if the input changes in such a way that Incremental.Cutoff.should_cutoff cutoff ~old_value ~new_value is true, the result does not change.

val map : ('input, 'r1, 'incr, 'event) t -> f:(('r1, 'incr) Incremental.t -> ('r2, 'incr) Incremental.t) -> ('input, 'r2, 'incr, 'event) t

Transforms the result of a component, exposing the incrementality for optimization purposes.

val map_input : ('i2, 'result, 'incr, 'event) t -> f:(('i1, 'incr) Incremental.t -> ('i2, 'incr) Incremental.t) -> ('i1, 'result, 'incr, 'event) t

Transforms the input of a component, exposing the incrementality for optimization purposes. The signature of f is reversed from most other map functions.