package bonsai
Module Generic.With_incr
val of_incr : ('result, 'incr) Incremental.t -> (_, 'result, 'incr, _) tConstructs 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, _) tSame 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) tSame as Bonsai.leaf, but incremental
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, _, _) tAn 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) tTransforms 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) tTransforms the input of a component, exposing the incrementality for optimization purposes. The signature of f is reversed from most other map functions.