import * as tsplus_module_1 from "@tsplus/stdlib/data/Maybe/getOrElse";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Tuple/make";
import * as tsplus_module_3 from "@effect/core/io/FiberRef/operations/modify";
/**
 * Atomically modifies the `XFiberRef` with the specified function and returns
 * the old value. If the function is `None` for the current value it doesn't
 * change it.
 *
 * @tsplus fluent ets/FiberRef getAndUpdateSome
 */

export function getAndUpdateSome_(self, pf, __tsplusTrace) {
  return tsplus_module_3.modify_(self, v => tsplus_module_2.make(v, tsplus_module_1.getOrElse_(pf(v), () => v)), __tsplusTrace);
}
/**
 * Atomically modifies the `XFiberRef` with the specified function and returns
 * the old value. If the function is `None` for the current value it doesn't
 * change it.
 *
 * @tsplus static ets/FiberRef/Aspects getAndUpdateSome
 */

export const getAndUpdateSome = (pf, __tsplusTrace) => self => getAndUpdateSome_(self, pf, __tsplusTrace);
//# sourceMappingURL=getAndUpdateSome.mjs.map