Module type Summary.OBSERVABLE

Observables

OBSERVABLE captures the pattern of backtrackable state that can be enabled and disabled. To use it, register the value that you want to record and then activate and deactivate the value using the returned token.

Indirection is used to be able to handle non-marshallable values.

type token

The type of tokens to manipulate values. This is always marshallable.

type value

The value being stored. May be non-marshallable (typically a closure).

val register : name:string -> ?override:bool -> value -> token

Register a new value and get the token used to enable and disable it.

val activate : token -> unit

Activate/deactive the value attached to the token.

val deactivate : token -> unit
val is_active : token -> bool

Determine if the value for the given token is active.