effect-io-ai

Package: effect
Module: SynchronizedRef

SynchronizedRef.modifySomeEffect

Runs an effectful modification atomically while holding the ref’s semaphore. The effect computes a return value and an optional new ref value; Option.some updates the ref and Option.none leaves it unchanged.

When to use

Use to effectfully compute a return value while optionally updating the stored SynchronizedRef value.

See

Signature

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

Source

Since v2.0.0