import * as tsplus_module_1 from "@tsplus/stdlib/data/Maybe/definition";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/succeedNow";
import * as tsplus_module_3 from "@effect/core/stm/TRef/operations/set";
import * as tsplus_module_4 from "@effect/core/stm/STM/operations/zipRight";
import * as tsplus_module_5 from "@effect/core/stm/TRef/operations/get";
import * as tsplus_module_6 from "@effect/core/stm/STM/operations/flatMap";
import { concreteTDeferred } from "@effect/core/stm/TDeferred/operations/_internal/InternalTDeferred";
/**
 * @tsplus fluent ets/TDeferred done
 */

export function done_(self, v) {
  void 0;
  return tsplus_module_6.flatMap_(tsplus_module_5.get(self.ref), _ => tsplus_module_1.isSome(_) ? tsplus_module_2.succeedNow(false) : tsplus_module_4.zipRight_(tsplus_module_3.set_(self.ref, tsplus_module_1.some(v)), () => tsplus_module_2.succeedNow(true)));
}
/**
 * @tsplus static ets/TDeferred/Aspects done
 */

export const done = v => self => done_(self, v);
//# sourceMappingURL=done.mjs.map