effect-io-ai

Package: effect
Module: SynchronizedRef

SynchronizedRef.modifyEffect

Runs an effectful modification atomically while holding the ref’s semaphore, stores the new value if the effect succeeds, and returns the computed result.

When to use

Use to effectfully compute both a separate return value and the next stored SynchronizedRef value in one serialized update.

See

Signature

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

Source

Since v2.0.0