package par_incr

  1. Overview
  2. Docs

Module Par_incr.VarSource

Defines the type and various operations for modifiable values.

Sourcetype 'a t

A 'a Var.t will hold a value of type 'a. Unlike 'a t, this can be read and changed. This is our handle to values that can be mutated and the computations can then be propagated efficiently.

Sourceval create : ?cutoff:'a Cutoff.t -> ?to_s:('a -> string) -> 'a -> 'a t

Var.create x creates a Var.t with value x. Optionally you can specify cutoff and to_s parameters as well. Default for cutoff is Phys_equal and it's recommended to pass cutoff wherever the default doesn't work.

Sourceval set : 'a t -> 'a -> unit

Var.set t x sets the value of t to x. In case x is same as the old value, it won't do anything. If x is not equal to the old value, it'll mark all the computations that depend on t to be ready for propagation.

Sourceval value : 'a t -> 'a

Var.value t returns the value stored inside t.

Sourceval watch : 'a t -> 'a incremental

Var.value t converts 'a Var.t to 'a incremental. This is what lets us apply many combinators made available by the library and write bigger incremental programs.

Sourcemodule Syntax : sig ... end

Syntax module introduces some convenient operators for Var.set and Var.value operations.

OCaml

Innovation. Community. Security.