Module Generic.Expert
type ('input, 'model, 'action, 'result, 'incr, 'event) unpackedunpackedexposes the action type of a component as an existential.
type ('input, 'result, 'incr, 'event) t= private|T :{unpacked : ('input, 'model, 'action, 'result, 'incr, 'event) unpacked;action_type_id : 'action Core_kernel.Type_equal.Id.t;model : 'model Bonsai_types.Packed.model_info;}-> ('input, 'result, 'incr, 'event) tEvery Bonsai component has a hidden
'actiontype, which can be revealed as an existential by pattern matching ont.
val reveal : ('input, 'result, 'incr, 'event) nonexpert_t -> ('input, 'result, 'incr, 'event) treveal tis just the identity, but it allows you to pattern match on the GADT to get the unpacked component (which you caneval) and the action's type ID.
val conceal : ('input, 'result, 'incr, 'event) t -> ('input, 'result, 'incr, 'event) nonexpert_tconcealis the inverse ofreveal.
val of_full : Core_kernel.Source_code_position.t -> f:(input:('input, 'incr) Incremental.t -> old_model:('model option, 'incr) Incremental.t -> model:('model, 'incr) Incremental.t -> inject:('action -> 'event) -> environment:'incr Bonsai_types.Environment.t -> incr_state:'incr Incremental.State.t -> (('model, 'action, 'result, 'event) Bonsai__.Import.Snapshot.t, 'incr) Incremental.t) -> action_type_id:'action Core_kernel.Type_equal.Id.t -> model_type_id:'model Core_kernel.Type_equal.Id.t -> default_model:'model -> model_equal:('model -> 'model -> bool) -> sexp_of_model:('model -> Core_kernel.Sexp.t) -> model_of_sexp:(Core_kernel.Sexp.t -> 'model) -> ('input, 'result, 'incr, 'event) tBuilds a component out of the incremental function from
'model Incr.ttoSnapshot.t Incr.t. This function is in the expert module because it is effectively a black box to the rest of the Bonsai library, which meansoptimizecannot do anything with it, for example.
val eval : input:('input, 'incr) Incremental.t -> old_model:('model option, 'incr) Incremental.t -> model:('model, 'incr) Incremental.t -> inject:('action -> 'event) -> action_type_id:'action Core_kernel.Type_equal.Id.t -> environment:'incr Bonsai_types.Environment.t -> incr_state:'incr Incremental.State.t -> ('input, 'model, 'action, 'result, 'incr, 'event) unpacked -> (('model, 'action, 'result, 'event) Bonsai__.Import.Snapshot.t, 'incr) Incremental.tWalks the component tree and builds a
Snapshot.t Incr.twhich will be recomputed whenmodelandold_modelchange.
val optimize : ('input, 'result, 'incr, 'event) t -> ('input, 'result, 'incr, 'event) tPerforms constant-folding and other optimizations on the component tree. This function is called once-per-component tree, which should be roughly once-per-application life-cycle unless there is dynamic component tree creation going on (perhaps via
of_fullandeval).
module Snapshot = Bonsai__.Import.Snapshot