UNPKG

@effect-ts/system

Version:

Effect-TS is a zero dependency set of libraries to write highly productive, purely functional TypeScript at scale.

11 lines (9 loc) 316 B
// ets_tracing: off import * as Tp from "../Collections/Immutable/Tuple/index.js" import { modify } from "./modify.js" /** * Atomically modifies the `FiberRef` with the specified function and returns * the old value. */ export const getAndUpdate = <A>(f: (a: A) => A) => modify<A, A>((v) => Tp.tuple(v, f(v)))