package bonsai

  1. Overview
  2. Docs
On This Page
  1. Dynamic dispatch
Legend:
Library
Module
Module type
Parameter
Class
Class type
module Snapshot : sig ... end

A Snapshot represents the state of a component at an instant in time.

module Environment : sig ... end
type on_action_mismatch = [
  1. | `Ignore
  2. | `Raise
  3. | `Warn
]
module type Model = sig ... end
module type Action = sig ... end
module type Comparator = sig ... end

We need keys to have t_of_sexp and sexp_of_t

type ('k, 'cmp) comparator = (module Comparator with type comparator_witness = 'cmp and type t = 'k)
type ('input, 'model, 'action, 'result, 'incr, 'event) unpacked = ..
val unit_type_id : unit Core_kernel.Type_equal.Id.t
type ('input, 'model, 'action, 'result, 'incr, 'event) eval_type = 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 Environment.t -> incr_state:'incr Incremental.State.t -> ('input, 'model, 'action, 'result, 'incr, 'event) unpacked -> (('model, 'action, 'result, 'event) Snapshot.t, 'incr) Incremental.t
module Packed : sig ... end
module Visitor : sig ... end
module type Definition = sig ... end
val define : (module Definition) -> unit

Dynamic dispatch

The functions below dispatch on the extension constructor of the input component, which must have been registered with define.

val eval_ext : 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 Environment.t -> incr_state:'incr Incremental.State.t -> ('input, 'model, 'action, 'result, 'incr, 'event) unpacked -> (('model, 'action, 'result, 'event) Snapshot.t, 'incr) Incremental.t
val visit_ext : ('input, 'result, 'incr, 'event) Packed.t -> Visitor.t -> ('input, 'result, 'incr, 'event) Packed.t

Depth-first mapping transformation over a component tree.

The reason that visit_ext takes (and returns) Packed.t values instead of unpacked values is so that an optimization stage can change the type of an action parameter during optimization

val sexp_of_unpacked : (_, _, _, _, _, _) unpacked -> Core_kernel.Sexp.t
OCaml

Innovation. Community. Security.