"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
exports.fold = exports.fold_ = void 0
// tracing: off
const core_1 = require("./core")
const foldM_1 = require("./foldM")
/**
 * Folds over the failure value or the success value to yield an effect that
 * does not fail, but succeeds with the value returned by the left or right
 * function passed to `fold`.
 */
function fold_(value, failure, success, __trace) {
  return (0, foldM_1.foldM_)(
    value,
    (e) => (0, core_1.succeed)(failure(e)),
    (a) => (0, core_1.succeed)(success(a)),
    __trace
  )
}
exports.fold_ = fold_
/**
 * Folds over the failure value or the success value to yield an effect that
 * does not fail, but succeeds with the value returned by the left or right
 * function passed to `fold`.
 *
 * @dataFirst fold_
 */
function fold(failure, success, __trace) {
  return (value) => fold_(value, failure, success, __trace)
}
exports.fold = fold
//# sourceMappingURL=fold.js.map
