import * as tsplus_module_1 from "@effect/core/io/Effect/operations/failNow";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/succeed";
import * as tsplus_module_3 from "@effect/core/io/Effect/operations/flatMap";
import * as tsplus_module_4 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_5 from "@tsplus/stdlib/data/Maybe/fold";
/**
 * Extracts the optional value, or fails with the given error 'e'.
 *
 * @tsplus fluent ets/Effect someOrFail
 */

export function someOrFail_(self, orFail, __tsplusTrace) {
  return tsplus_module_3.flatMap_(self, option => tsplus_module_5.fold_(option, () => tsplus_module_3.flatMap_(tsplus_module_2.succeed(orFail, __tsplusTrace), tsplus_module_1.failNow, __tsplusTrace), tsplus_module_4.succeedNow), __tsplusTrace);
}
/**
 * Extracts the optional value, or fails with the given error 'e'.
 *
 * @tsplus static ets/Effect/Aspects someOrFail
 */

export const someOrFail = (orFail, __tsplusTrace) => self => someOrFail_(self, orFail, __tsplusTrace);
//# sourceMappingURL=someOrFail.mjs.map