Bonsai.ExpertSourceval state_machine01 :
(module Model with type t = 'model) ->
(module Action with type t = 'dynamic_action) ->
(module Action with type t = 'static_action) ->
?reset:
(inject_dynamic:('dynamic_action -> unit Effect.t) ->
inject_static:('static_action -> unit Effect.t) ->
schedule_event:(unit Effect.t -> unit) ->
'model ->
'model) ->
default_model:'model ->
apply_dynamic:
(inject_dynamic:('dynamic_action -> unit Effect.t) ->
inject_static:('static_action -> unit Effect.t) ->
schedule_event:(unit Effect.t -> unit) ->
'input ->
'model ->
'dynamic_action ->
'model) ->
apply_static:
(inject_dynamic:('dynamic_action -> unit Effect.t) ->
inject_static:('static_action -> unit Effect.t) ->
schedule_event:(unit Effect.t -> unit) ->
'model ->
'static_action ->
'model) ->
'input Value.t ->
('model
* ('dynamic_action ->
unit Effect.t)
* ('static_action ->
unit Effect.t))
Computation.tthunk will execute its argument exactly once per instantiation of the computation.
val assoc_on :
('io_key, 'io_cmp) comparator ->
('model_key, 'model_cmp) comparator ->
('io_key, 'data, 'io_cmp) Core.Map.t Value.t ->
get_model_key:('io_key -> 'data -> 'model_key) ->
f:('io_key Value.t -> 'data Value.t -> 'result Computation.t) ->
('io_key, 'result, 'io_cmp) Core.Map.t Computation.tassoc_on is similar to assoc, but allows the model to be keyed differently than the input map. This comes with a few caveats:
model_key will share the same model.get_model_key is used in a bind, so it is expensive when it changes.assoc should almost always be used instead. Consider whether you really need the additional power before reaching for this function.