import * as tsplus_module_1 from "@effect/core/stm/STM/operations/effect";
import { getOrMakeEntry } from "@effect/core/stm/TRef/operations/_internal/getOrMakeEntry";
/**
 * Updates the value of the variable.
 *
 * @tsplus fluent ets/TRef update
 */

export function update_(self, f) {
  return tsplus_module_1.effect(journal => {
    const entry = getOrMakeEntry(self, journal);
    const newValue = entry.use(_ => f(_.unsafeGet()));
    entry.use(_ => _.unsafeSet(newValue));
    return undefined;
  });
}
/**
 * Updates the value of the variable.
 *
 * @tsplus static ets/TRef/Aspects update
 */

export const update = f => self => update_(self, f);
//# sourceMappingURL=update.mjs.map