effect-io-ai

Package: effect
Module: SynchronizedRef

SynchronizedRef.getAndUpdateSome

Applies a partial update atomically and returns the previous value. If the function returns Option.some, the ref is updated; if it returns Option.none, the ref is left unchanged.

When to use

Use to return the previous SynchronizedRef value while applying a pure conditional update.

See

Signature

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

Source

Since v2.0.0