package affect

  1. Overview
  2. Docs

Module Cell.LazySource

Lazy immutable cells.

A lazy immutable cell is an immutable cell whose content is computed exactly once:

  • A Lazy.force blocks until the cell's value is computed.

Cells

Sourcetype 'a t

The type for lazy immutable cells.

Sourceval make : (unit -> 'a) -> 'a t

make f is a new lazy cell computed with f () by the first function that calls force l.

Sourceval from_val : 'a -> 'a t

from_val v is a lazy cell already forced to v.

Sourceval from_exn : exn -> Printexc.raw_backtrace -> 'a t

from_exn exn bt is a lazy cell already forced to the exception exn with backtrace bt.

Sourceval force : 'a t -> 'a

force cell blocks until cell's value (or exception) is computed and continues with it. The first caller to force on cell doesn't block, it executes the thunk and continues with the result.

Predicates

Sourceval is_forced : 'a t -> bool

is_forced cell is true if and only if cell has been forced.

Sourceval is_val : 'a t -> bool

is_val cell is true if and only if cell has been forced and did not raise an exception.

Actions

Sourceval force' : 'a t -> 'a Action.t

force' cell is the action for force. An action invocation is permanently enabled and synchronizes with the cell's value (or exception) once it has been computed by the first action invocation.