package lwd
Library
Module
Module type
Parameter
Class
Class type
val return : 'a -> 'a t
The content document with the given value inside
map f d
is the document that has value f x
whenever d
has value x
map2 f d1 d2
is the document that has value f x y
whenever d1
has value x1
and d2
has value x2
Monadic operator join d
is the document pointed to by document d
. This is powerful but potentially costly in case of recomputation.
Applicative: app df dx
is the document that has value f x
whenever df
has value f
and dx
has value x
val is_pure : 'a t -> 'a option
val var : 'a -> 'a var
Create a new variable with the given initial value
val set : 'a var -> 'a -> unit
Change the variable's content, invalidating all documents depending on it.
val peek : 'a var -> 'a
Observe the current value of the variable, without any dependency tracking.
A primitive document. It can correspond, for example, to a primitive UI element.
A primitive is a resource with acquire
and release
functions to manage its lifecycle.
val prim : acquire:(unit -> 'a) -> release:('a -> unit) -> 'a prim
create a new primitive document.
val invalidate : 'a prim -> unit
type release_failure = exn * Printexc.raw_backtrace
Releasing unused graphs
exception Release_failure of exn option * release_failure list
val make_release_queue : unit -> release_queue
val flush_release_queue : release_queue -> release_failure list
observe x
creates a root that contains document x
.
val set_on_invalidate : 'a root -> ('a -> unit) -> unit
Change the callback for the root. See observe
for more details.
val sample : release_queue -> 'a root -> 'a
Force the computation of the value for this root. The value is cached, so this is idempotent, until the next invalidation.
val is_damaged : 'a root -> bool
is_damaged root
is true if the root doesn't have a valid value in cache. This can be the case if the value was never computed, or if it was computed and then invalidated.
val release : release_queue -> 'a root -> unit
Forget about this root and release sub-values no longer reachable from any root.
val quick_sample : 'a root -> 'a
val quick_release : 'a root -> unit
module Infix : sig ... end
val dump_trace : 'a t -> unit