Module Note.Logr

Event and signal changes loggers.

Loggers are the output interface of the reactive system. They allow external entities to observe event occurences and signal changes.

Observations

type 'a obs

The type for observing changes of type 'a.

val const : 'a -> 'a obs

const v never changes and always observes v.

val app : ('a -> 'b) obs -> 'a obs -> 'b obs

app f v is the observation that result from applying the changes of f to the ones of v.

val ($) : ('a -> 'b) obs -> 'a obs -> 'b obs

f $ v is app f v.

Loggers

type t

The type for loggers.

val create : ?⁠now:bool -> unit obs -> t

create ~now o is a logger that observes changes to o. If now is true (default) logs at least one observation before the call returns.

val force : t -> unit

force l observes l even if nothing changed.

val destroy : t -> unit

destroy l destroys log l this ensure that l's does not observe any change again. The underlying observed events or signals also stop updating, unless they are observed by another logger.

val hold : t -> unit

hold l holds logger l to ensure it does not get garbage collected.

val may_hold : t option -> unit

may_hold l holds logger Some l to ensure it does not get garbage collected. Does nothing on None.

val unhold_all : unit -> unit

unhold_all () destroys and unholds all loggers held via hold.