Imandrakit_thread.RvarReactive variable.
A reactive variable holds state, and can change state over time. One can subscribe to changes or just get the current value.
val return : 'a -> 'a tA frozen variable with the given content.
val get : 'a t -> 'aGet the current value.
val pp : 'a Imandrakit.Fmt.printer -> 'a t Imandrakit.Fmt.printerval mk_var : 'a -> 'a tMake a new variable with the given initial value
val set : 'a t -> 'a -> unitSet the value. This will trigger all the callbacks registered via on_change.
val update : 'a t -> f:('a -> 'a * 'b) -> 'bModifies content and return side value.
val freeze : _ t -> unitPrevent further mutations. Idempotent.
on_change rv f subscribes f to be called whenever rv changes. When rv is set to a new value x, f (Some x) is called. When rv is frozen, f None is called (and then f will never be called again).
If rv is already frozen then f None will be called immediately.
val of_fut_or_error : 'a Fut.t -> 'a Fut.or_error option tPick a value from a list of variables. The result is a variable that is always as up-to-date as any of the inputs.
cutoff v produces a new variable that always has the same value as v, but only emits "on change" events when the new value differs from the old one.
module Monoid : sig ... endmonoid_merge m ~f v1 v2 maps each variable using f and then merges the results using the given monoid.
monoid_merge m ~f rvs maps each variable using f and then merges the results using the given monoid.
module Infix : sig ... end