Package: effect
Module: SynchronizedRef
Updates the current value atomically with a function and returns the previous value, serialized by the ref’s semaphore.
When to use
Use to run a pure SynchronizedRef state update when the previous stored
value is also needed.
See
update for updating without returning a valueupdateAndGet for updating and returning the new valuegetAndUpdateEffect for effectful updates that return the previous valueSignature
declare const getAndUpdate: { <A>(f: (a: A) => A): (self: SynchronizedRef<A>) => Effect.Effect<A>; <A>(self: SynchronizedRef<A>, f: (a: A) => A): Effect.Effect<A>; }
Since v2.0.0