Skip to content

Builders

module Builders
AssemblyRanvier
Attributes[<AutoOpen>]

Computation expression builders and reactive combinators opened via open Ranvier.CE.

Reactive builders (memo, effect, bridge, asyncMemo, stream) compile Phase-1 let! ... and! ... binds into fused static nodes without graph.Activate () and run Phase-2 bodies untracked.

Functions and values

asyncMemo: AsyncMemoBuilder

Computation expression builder producing AsyncMemo<'U> nodes with compile-time Phase-1/Phase-2 dispatch.

Phase-1 let! ... and! ... reactive binds compile to static AsyncMemo.CreateOn in O(1) without graph.Activate (), launching Phase-2 Task/ValueTask flights untracked (owning, policy, comparer, and debounce/throttle* headers).

batched: BatchedBuilder

Computation expression builder deferring effect execution across grouped signal writes (batch).

Enter overhead is O(1); deferred passes and effects flush once when the outermost batch exits.

boundary: BoundaryBuilder

Computation expression builder producing Boundary<'U> suspense/error boundaries.

Catches NotReadyException (pending) and/or exceptions (failed) from tracked Phase-1 let! ... and! ... reads in O(1), running Phase 2 untracked inside an owning scope (comparer).

bridge<'a, 'T when 'a :> ISignalTarget<'T>> (target: 'a) : BridgeBuilder<'T>

Creates a computation expression builder bridging derived values from a source graph into target (Signal or SignalPort) via its coalescing port.

Compiles Phase-1 let! ... and! ... binds without graph.Activate (), with two-level input/output cutoff and O(1) / 0 B off-thread coalescing. Use dispatch instead for FIFO ordered commands or transactions.

Raises
System.ArgumentNullExceptiontarget is null.
cleanup: CleanupBuilder

Computation expression builder registering a unit cleanup action on the innermost enclosing scope.

Registers a LIFO cleanup in O(1) (onCleanup), running untracked before re-run and at disposal.

debounced<'T> (delay: TimeSpan) (source: IReactive<'T>) : Timed<'T>

Creates an owned Timed<'T> node debouncing source by delay on source.Graph.

Time: O(1) per capture; space: O(1) single timer.

debouncedWith<'T> (options: TimedOptions<'T>) (delay: TimeSpan) (source: IReactive<'T>) : Timed<'T>

Creates an owned Timed<'T> node debouncing source by delay with options on source.Graph.

Time: O(1) per capture; space: O(1) single timer.

dispatch (graph: Graph) : DispatchBuilder

Creates a computation expression builder marshaling work into graph's consistency domain (Graph.Dispatch for unit blocks, Graph.DispatchAsync when return or cancellation is used).

Enqueues FIFO commands or multi-signal transactions (O(queued calls) space, optional Task<'T> result). Prefer bridge or SignalPort for O(1) / 0 B coalesced latest-state propagation.

Raises
System.ArgumentNullExceptiongraph is null.
draft: DraftBuilder

Computation expression builder producing draft Editable<'U> handles.

Seeds a locally writable draft Editable<'U> (1 signal + 2 memos, O(1)) whose Phase-2 body runs untracked and retains form edits across upstream reloads until Reset (); use editable to drop on change.

editable: EditableBuilder

Computation expression builder producing Editable<'U> handles.

Seeds a locally writable Editable<'U> (1 signal + 2 memos, O(1)) whose Phase-2 body runs untracked and drops local overrides on unequal upstream seeds; use draft to retain form edits until Reset ().

effect: EffectBuilder

Computation expression builder producing Effect / EffectOn nodes with closed action bodies.

Phase-1 let! ... and! ... binds compile to static EffectOn nodes in O(1) without graph.Activate (), running the Phase-2 action untracked in an owning scope (node and debounce/throttle* headers).

memo: MemoBuilder

Computation expression builder producing Memo<'U> nodes with closed Phase-2 bodies.

Phase-1 let! ... and! ... binds compile to fused static SignalMap/CreateOn/SplitBind nodes in O(1) without graph.Activate (), running Phase 2 untracked (owning, option, comparer, and debounce/throttle* headers).

memoTable: MemoTableBuilder

Computation expression builder producing bounded reactive MemoTable<'K, 'V> instances.

Bounded weighted-LRU pull cache (O(1) amortized hit, maxEntries/maxWeight, optional stamp) over large, open, or recursive key spaces (memoTable.key). Contrast: Lookup (O(affected) push index), KeyedCollection (mutable signal map), and Projection + row (ordered list).

root: RootBuilder

Computation expression builder creating a nested disposable Owner scope (createRoot).

Allocates an Owner scope in O(1), returning the Owner directly for unit bodies or 'T when let! o = root.owner and return are used.

row: RowBuilder

Computation expression builder producing per-key projection readers unit -> 'V.

Compiles per-key let! ... and! ... reads of row item thunks and IReactive<'A> sources into a 0-node unit -> 'V reader for createProjectionWith and Projection.mapWith, running Phase 2 untracked (O(1) per demanded row).

signal: SignalBuilder

Computation expression builder producing Signal<'T> sources on the active Graph.

Resolves Graph.Current in O(1) (O(1) reads, O(observers) writes; optional comparer header). Narrow to read-only via Signal.readOnly or write-only via Signal.createPort.

stream: StreamBuilder

Computation expression builder producing StreamMemo<'U> nodes with latest-item or fold mode.

Phase-1 let! ... and! ... reactive binds compile to static StreamMemo.CreateOn/CreateFoldOn in O(1) without graph.Activate (), running Phase-2 stream setup untracked (fold and debounce/throttle* headers).

throttled<'T> (interval: TimeSpan) (source: IReactive<'T>) : Timed<'T>

Creates an owned Timed<'T> node throttling source by interval (leading + trailing) on source.Graph.

Time: O(1) per capture; space: O(1) single timer.

throttledFirst<'T> (interval: TimeSpan) (source: IReactive<'T>) : Timed<'T>

Creates an owned Timed<'T> node throttling source by interval (leading edge only) on source.Graph.

Time: O(1) per capture; space: O(1) with zero timers.

throttledFirstWith<'T> (options: TimedOptions<'T>) (interval: TimeSpan) (source: IReactive<'T>) : Timed<'T>

Creates an owned Timed<'T> node throttling source by interval (leading edge only) with options on source.Graph.

Time: O(1) per capture; space: O(1) with zero timers.

throttledLast<'T> (interval: TimeSpan) (source: IReactive<'T>) : Timed<'T>

Creates an owned Timed<'T> node throttling source by interval (trailing edge only) on source.Graph.

Time: O(1) per capture; space: O(1) single timer.

throttledLastWith<'T> (options: TimedOptions<'T>) (interval: TimeSpan) (source: IReactive<'T>) : Timed<'T>

Creates an owned Timed<'T> node throttling source by interval (trailing edge only) with options on source.Graph.

Time: O(1) per capture; space: O(1) single timer.

throttledWith<'T> (options: TimedOptions<'T>) (interval: TimeSpan) (source: IReactive<'T>) : Timed<'T>

Creates an owned Timed<'T> node throttling source by interval (leading + trailing) with options on source.Graph.

Time: O(1) per capture; space: O(1) single timer.

tryRead<'S, 'T when 'S :> ITryReactive<'T>> (source: 'S) : ReadingReactive<'S,'T>

Wraps source so Phase-1 let! binds read Reading<'T> (Ready, Pending, or Failed) via .TryValue without suspending or faulting the enclosing computation.

Raises
System.ArgumentNullExceptionsource is null.
untracked: UntrackedBuilder

Computation expression builder executing reads without recording reactive dependencies (untrack).

Enter and restore run in O(1) without allocating a scope.

withComparer<'K> (comparer: IEqualityComparer<'K>) (source: IReactive<'K>) : ComparedReactive<'K>

Wraps source so Phase-1 key comparison in effect, memo, asyncMemo, or stream compares keys under comparer instead of the graph's equality policy.

Raises
System.ArgumentNullExceptioncomparer or source is null.