package bonsai
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=43f35d648644492d776bf2c7b86c8227e7793615b6a658432e95f8dccd3631f8
md5=b5e743dbfa64d0da5fd660f14cd0b549
doc/bonsai.web/Bonsai_web/Bonsai/index.html
Module Bonsai_web.Bonsai
module Incr = Incr_dom.Incrmodule Event : sig ... endinclude Bonsai.S_gen
with module Incr := Incr
with module Event := Event
with type 'a Proc.Computation.t =
('a, Incr.state_witness, Event.t) Bonsai.Generic.Proc.Computation.t
The component type (('input, 'result) Bonsai.t) can be thought of as a function from 'model to 'result, but where the 'result can schedule events of the component's "action type". These actions are used to produce a new 'model which in turn causes the 'result to be recomputed. Instances of the 'result type can contain callbacks which schedule actions when interacted with by user (via button click, text input, etc). These actions are handled by the component's apply_action function, which yields a new model to be displayed.
val sexp_of_t : (_, _) t -> Core_kernel.Sexp.tval input : ('input, 'input) tA bonsai component that just forwards the input straight through to the result. This is equivalent to Bonsai.pure ~f:Fn.id.
Component Constructors
val const : 'result -> (_, 'result) tReturns a component with no action or model, only a constant result.
val pure : f:('input -> 'result) -> ('input, 'result) tA pure function with no model from 'input to 'result
compose a b joins a and b together such that the result of a is used as the input of b.
module type S = sig ... endMany modules have the same shape, they declare the model, action, and result of the component, and then define apply_action and view over those types.
val of_module :
('input, 'model, 'action, 'result) component_s ->
default_model:'model ->
('input, 'result) tmodule type Enum = sig ... endval if_ :
('input -> bool) ->
then_:('input, 'result) t ->
else_:('input, 'result) t ->
('input, 'result) tif_ is a simple application of enum to (module Bool).
module Infix : sig ... endFor composing components which share the same model. For example, applying an action in one component changes the shared model, which is reflected in the results of the other component.
include Core_kernel.Applicative.S2 with type ('r, 'i) t := ('i, 'r) t
val return : 'a -> (_, 'a) tmodule Applicative_infix : sig ... endTransforms the input of a component. The signature of f is reversed from most other map functions.
module Proc : sig ... endmodule Let_syntax : sig ... endCombinators
val state_machine :
(module Bonsai_types.Model with type t = 'model) ->
(module Bonsai_types.Action with type t = 'action) ->
Core_kernel.Source_code_position.t ->
default_model:'model ->
apply_action:
(inject:('action -> Event.t) ->
schedule_event:(Event.t -> unit) ->
'input ->
'model ->
'action ->
'model) ->
('input, 'model * ('action -> Event.t)) tmodule Map : sig ... endmodule List_deprecated : sig ... endProjecting over lists in Bonsai is fraught with issues. 1. Incremental can't be optimized for linked-list data structures. 2. Using list-index as the method for routing actions to components is basically never what you actually want, causing mis-delivery of events every time that the list changes.
module Arrow : sig ... end('i, _, 'r) t is an arrow from 'i to 'r.
module With_incr : sig ... endval to_generic :
('input, 'result) t ->
('input, 'result, Incr.state_witness, Event.t) Bonsai.Generic.tval of_generic :
('input, 'result, Incr.state_witness, Event.t) Bonsai.Generic.t ->
('input, 'result) t