package incr_select
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=52848ff15a1636c24b3ad79be99a4324c48341a928bc38cd3bbbd4a1a65c1134
md5=d00eb011ede05fdbf39d23243078531b
doc/incr_select/Incr_select/Make/argument-1-Incr/Var/index.html
Module Incr.Var
val sexp_of_t :
('a -> Ppx_sexp_conv_lib.Sexp.t) ->
'a t ->
Ppx_sexp_conv_lib.Sexp.tval create : ?use_current_scope:bool -> 'a -> 'a tBy default, a variable is created in Scope.top, on the theory that its value depends on external stimuli (via Var.set), not on the current scope. However, in some situations it is useful to supply ~use_current_scope:true to create a variable that is invalidated when the current scope is invalidated, e.g. if one wants to use on_update (watch var) ~f:(function Invalidated -> ... | ...) to remove the external stimulus that was setting var.
It is allowed to do let t = create a during stabilization; for that stabilization, watch t will have value a.
val set : 'a t -> 'a -> unitset t a sets the value of t to a. Outside of stabilization, subsequent calls to Var.value t will see a, but the set will not have any effect on incrementals until the next stabilization, at which point watch t will take on whatever value t was at the start of stabilization, causing incremental recomputation as usual.
During a stabilization, calling set will behave as if set was called after stabilization finished: the new value will not be seen (by value v or watch v) until after the stabilization finishes.
val watch : 'a t -> 'a incrementalwatch t returns an incremental that tracks the value of t. For a given t, all calls to watch t return the same incremental.
val value : 'a t -> 'avalue t returns the value most recently set for t outside of stabilization.
val latest_value : 'a t -> 'alatest_value t returns the value most recently set for t. It can differ from value t only during stabilization.