Module Bonsai_web__Import.Bonsai
module Incr = Incrmodule Event = Eventinclude 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
module Incr : Incremental.Smodule Event : Bonsai__.Event.Stype ('input, 'result) tThe component type (
('input, 'result) Bonsai.t) can be thought of as a function from'modelto'result, but where the'resultcan schedule events of the component's "action type". These actions are used to produce a new'modelwhich in turn causes the'resultto be recomputed. Instances of the'resulttype can contain callbacks which schedule actions when interacted with by user (via button click, text input, etc). These actions are handled by the component'sapply_actionfunction, 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
val compose : ('i1, 'r1) t -> ('r1, 'r2) t -> ('i1, 'r2) tcompose a bjoinsaandbtogether such that the result ofais used as the input ofb.
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.
type ('input, 'model, 'action, 'result) component_s= (module S with type Action.t = 'action and type Input.t = 'input and type Model.t = 'model and type Result.t = 'result)
val of_module : ('input, 'model, 'action, 'result) component_s -> default_model:'model -> ('input, 'result) t
module type Enum = sig ... endval enum : (module Enum with type t = 'key) -> which:('input -> 'key) -> handle:('key -> ('input, 'result) t) -> ('input, 'result) tval if_ : ('input -> bool) -> then_:('input, 'result) t -> else_:('input, 'result) t -> ('input, 'result) tif_is a simple application ofenumto(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
include Base__.Applicative_intf.For_let_syntax2
val return : 'a -> ('a, _) tval map : ('a, 'e) t -> f:('a -> 'b) -> ('b, 'e) tval both : ('a, 'e) t -> ('b, 'e) t -> ('a * 'b, 'e) t
include Base__.Applicative_intf.Applicative_infix2 with type ('a, 'e) t := ('a, 'e) t
val apply : ('a -> 'b, 'e) t -> ('a, 'e) t -> ('b, 'e) tval map2 : ('a, 'e) t -> ('b, 'e) t -> f:('a -> 'b -> 'c) -> ('c, 'e) tval map3 : ('a, 'e) t -> ('b, 'e) t -> ('c, 'e) t -> f:('a -> 'b -> 'c -> 'd) -> ('d, 'e) tval all : ('a, 'e) t list -> ('a list, 'e) tval all_unit : (unit, 'e) t list -> (unit, 'e) t
module Applicative_infix : Base__.Applicative_intf.Applicative_infix2 with type ('a, 'e) t := ('a, 'e) tval map_input : ('i2, 'result) t -> f:('i1 -> 'i2) -> ('i1, 'result) tTransforms the input of a component. The signature of
fis reversed from most other map functions.
module Proc : sig ... end with type 'a Computation.t = ('a, Incr.state_witness, Event.t) Bonsai.Generic.Proc.Computation.tmodule Let_syntax : sig ... endCombinators
val state_machine : (module Bonsai__.Bonsai_intf.Model with type t = 'model) -> (module Bonsai__.Bonsai_intf.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)) t
module Map : sig ... endmodule List_deprecated : sig ... endmodule Arrow : sig ... endmodule 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