effect-io-ai

Package: effect
Module: SynchronizedRef

SynchronizedRef.modify

Computes a return value and a new ref value atomically, stores the new value, and returns the computed result.

When to use

Use to derive a separate result and the next stored SynchronizedRef value from the same current value in one serialized pure update.

See

Signature

declare const modify: { <A, B>(f: (a: A) => readonly [B, A]): (self: SynchronizedRef<A>) => Effect.Effect<B>; <A, B>(self: SynchronizedRef<A>, f: (a: A) => readonly [B, A]): Effect.Effect<B>; }

Source

Since v2.0.0