import * as tsplus_module_1 from "@effect/core/io/Cause/definition";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/unit";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/failCauseNow";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/flatMap";
/**
 * When this effect succeeds with a cause, then this method returns a new
 * effect that either fails with the cause that this effect succeeded with, or
 * succeeds with unit, depending on whether the cause is empty.
 *
 * This operation is the opposite of `cause`.
 *
 * @tsplus fluent ets/Effect uncause
 */

export function uncause(self, __tsplusTrace) {
  return tsplus_module_4.flatMap_(self, cause => tsplus_module_1.isEmpty(cause) ? tsplus_module_2.unit : tsplus_module_3.failCauseNow(cause, __tsplusTrace), __tsplusTrace);
}
//# sourceMappingURL=uncause.mjs.map