effect-io-ai

Package: effect
Module: SynchronizedRef

SynchronizedRef.getAndUpdateSomeEffect

Runs an effectful partial update atomically while holding the ref’s semaphore and returns the previous value. Option.some updates the ref; Option.none leaves it unchanged.

When to use

Use to return the previous SynchronizedRef value while running an effectful conditional update.

See

Signature

declare const getAndUpdateSomeEffect: { <A, R, E>(pf: (a: A) => Effect.Effect<Option.Option<A>, E, R>): (self: SynchronizedRef<A>) => Effect.Effect<A, E, R>; <A, R, E>(self: SynchronizedRef<A>, pf: (a: A) => Effect.Effect<Option.Option<A>, E, R>): Effect.Effect<A, E, R>; }

Source

Since v2.0.0