Bonsai_arrow_deprecatedtype ('input, 'result) t =
'input Bonsai_proc.Value.t ->
'result Bonsai_proc.Computation.tNew apps should use the Bonsai library instead.
val const : 'result -> (_, 'result) tconst creates a Bonsai component with an unchanging output. It does not have an input, or a model. Constant components are not frequently used, but can be handy when using an API that requires a Bonsai.t, and you want the result to be constant.
This function is approximately the same as Fn.const.
val input : ('result, 'result) tinput is the identity function as a Bonsai component.
val pure : f:('input -> 'result) -> ('input, 'result) tpure is used to create a Bonsai component that can be implemented as a pure function from 'input to 'result
compose (and the >>> infix operator) connect the output from one component into the input of another component. This is conceptually similar to function composition: Fn.compose.
map (and the >>| infix operator ) transforms the result type of a Bonsai component using the provided function.
map_input (and the @>> infix operator) transforms the input type of a Bonsai component using the provided function.
val of_module :
here:lexing_position ->
?sexp_of_model:('model -> Core.Sexp.t) ->
(module Bonsai_arrow_deprecated__.Import.Component_s
with type Action.t = 'action
and type Input.t = 'input
and type Model.t = 'model
and type Result.t = 'result) ->
?equal:('model -> 'model -> bool) ->
default_model:'model ->
('input, 'result) tof_module is one of the most commonly used component constructors. The function takes a first-class module of type Component_s, as well as the default model for the component. For more details, please read the docs for Component_s.
Given two components that have the same input, both returns a Bonsai component that contains both of their outputs.
val state_machine :
sexp_of_action:('action -> Core.Sexp.t) ->
?sexp_of_model:('model -> Core.Sexp.t) ->
equal:('model -> 'model -> bool) ->
Core.Source_code_position.t ->
default_model:'model ->
apply_action:
(('action, unit) Bonsai_private_base.Apply_action_context.t ->
'input ->
'model ->
'action ->
'model) ->
('input, 'model * ('action -> unit Bonsai_private_base.Import.Effect.t)) tstate_machine is a function that is used to define a component solely in terms of its apply_action function. The result value of the component is the value of the current model alongside "context" that includes an injection function to transition the state machine
val enum :
here:lexing_position ->
(module Bonsai_private_base.Import.Enum with type t = 'key) ->
which:('input -> 'key) ->
handle:('key -> ('input, 'result) t) ->
('input, 'result) tenum is how a Bonsai component can branch on its input and handle different cases with a different Bonsai component.
The which function translates cases from the components input into values of type 'key.
The handle function translates the values returned by which into the component that handles this value.
val if_ :
here:lexing_position ->
('input -> bool) ->
then_:('input, 'result) t ->
else_:('input, 'result) t ->
('input, 'result) tif_ is a special case of enum for booleans.
module type S = Bonsai_private_base.Module_types.Component_smodule Map : sig ... endval arr : ('a -> 'b) -> ('a, 'b) tarr is the same as pure.
first t applies t to the first part of the input.
second t applies t to the second part of the input.
split t u applies t to the first part of the input and u to the second part.
extend_first returns the result of a Bonsai component alongside its input.
extend_second returns the result of a Bonsai component alongside its input.
fanout t u applies t and u to the same input and returns both results. It's actually just both.
t *** u = split t u.
t &&& u = fanout t u.
val partial_compose_first :
here:lexing_position ->
('input, 'shared * 'output1) t ->
('input * 'shared, 'output2) t ->
('input, 'output1 * 'output2) tComposes two components where one of the outputs of the first component is one of the inputs to the second.
val pipe :
here:lexing_position ->
('input, 'r1) t ->
into:('intermediate, 'r2) t ->
via:('input -> 'r1 -> 'intermediate) ->
finalize:('input -> 'r1 -> 'r2 -> 'r3) ->
('input, 'r3) tpipe connects two components, but provides several functions that ease the transference of data between the components, as well as collect the final result.
module With_incr : sig ... endmodule Infix : sig ... endmodule Let_syntax : sig ... end