import * as tsplus_module_1 from "@effect/core/stm/STM/operations/succeedNow";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/fail";
import * as tsplus_module_3 from "@tsplus/stdlib/data/Either/fold";
import * as tsplus_module_4 from "@effect/core/stm/STM/operations/flatMap";
/**
 * Returns a successful effect if the value is `Left`, or fails with the error e.
 *
 * @tsplus fluent ets/STM leftOrFail
 */

export function leftOrFail_(self, orFail) {
  return tsplus_module_4.flatMap_(self, _ => tsplus_module_3.fold_(_, tsplus_module_1.succeedNow, x => tsplus_module_2.fail(() => orFail(x))));
}
/**
 * Returns a successful effect if the value is `Left`, or fails with the error e.
 *
 * @tsplus static ets/STM/Aspects leftOrFail
 */

export const leftOrFail = orFail => self => leftOrFail_(self, orFail);
//# sourceMappingURL=leftOrFail.mjs.map