// 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 result.
*/
export function updateAndGet(f: (a: A) => A) {
return modify((v) => {
const result = f(v)
return Tp.tuple(result, result)
})
}