"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
exports.orDieWith_ = exports.orDieWith = void 0
// tracing: off
const core_1 = require("./core")
const die_1 = require("./die")
const foldM_1 = require("./foldM")
/**
 * Keeps none of the errors, and terminates the fiber with them, using
 * the specified function to convert the `E` into a `unknown`.
 *
 * @dataFirst orDieWith_
 */
function orDieWith(f, __trace) {
  return (effect) => orDieWith_(effect, f, __trace)
}
exports.orDieWith = orDieWith
/**
 * Keeps none of the errors, and terminates the fiber with them, using
 * the specified function to convert the `E` into a `unknown`.
 */
function orDieWith_(effect, f, __trace) {
  return (0, foldM_1.foldM_)(
    effect,
    (e) => (0, die_1.die)(f(e)),
    core_1.succeed,
    __trace
  )
}
exports.orDieWith_ = orDieWith_
//# sourceMappingURL=orDieWith.js.map
