"use strict"
var __createBinding =
  (this && this.__createBinding) ||
  (Object.create
    ? function (o, m, k, k2) {
        if (k2 === undefined) k2 = k
        Object.defineProperty(o, k2, {
          enumerable: true,
          get: function () {
            return m[k]
          }
        })
      }
    : function (o, m, k, k2) {
        if (k2 === undefined) k2 = k
        o[k2] = m[k]
      })
var __setModuleDefault =
  (this && this.__setModuleDefault) ||
  (Object.create
    ? function (o, v) {
        Object.defineProperty(o, "default", { enumerable: true, value: v })
      }
    : function (o, v) {
        o["default"] = v
      })
var __importStar =
  (this && this.__importStar) ||
  function (mod) {
    if (mod && mod.__esModule) return mod
    var result = {}
    if (mod != null)
      for (var k in mod)
        if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
          __createBinding(result, mod, k)
    __setModuleDefault(result, mod)
    return result
  }
Object.defineProperty(exports, "__esModule", { value: true })
exports.zipWith_ =
  exports.zipRight_ =
  exports.zipRight =
  exports.zipParRight =
  exports.zipParLeft =
  exports.zipPar =
  exports.zipLeft =
  exports.zip =
  exports.unit =
  exports.toEither =
  exports.succeeded =
  exports.orElseFail =
  exports.map_ =
  exports.mapError =
  exports.getOrElse =
  exports.fromOption =
  exports.fromEither =
  exports.fold_ =
  exports.fail =
  exports.exists =
  exports.die =
  exports.collectAllPar =
  exports.chain_ =
  exports.bimap =
  exports.zipWith =
  exports.mapErrorCause =
  exports.map =
  exports.interrupted =
  exports.interrupt =
  exports.fold =
  exports.flatten =
  exports.collectAll =
  exports.chain =
  exports.as =
  exports.ap =
  exports.halt =
  exports.Failure =
  exports.Success =
  exports.succeed =
  exports.forEach_ =
  exports.forEach =
  exports.foldM_ =
  exports.foldM =
    void 0
const T = __importStar(require("./_internal/effect"))
const Exit = __importStar(require("./core"))
/**
 * Folds over the value or cause.
 */
function foldM(failed, succeed) {
  return (exit) => foldM_(exit, failed, succeed)
}
exports.foldM = foldM
/**
 * Folds over the value or cause.
 */
function foldM_(exit, failed, succeed) {
  switch (exit._tag) {
    case "Success": {
      return succeed(exit.value)
    }
    case "Failure": {
      return failed(exit.cause)
    }
  }
}
exports.foldM_ = foldM_
/**
 * Applies the function `f` to the successful result of the `Exit` and
 * returns the result in a new `Exit`.
 */
function forEach(f) {
  return (exit) => forEach_(exit, f)
}
exports.forEach = forEach
/**
 * Applies the function `f` to the successful result of the `Exit` and
 * returns the result in a new `Exit`.
 */
function forEach_(exit, f) {
  switch (exit._tag) {
    case "Failure": {
      return T.succeed(Exit.halt(exit.cause))
    }
    case "Success": {
      return T.result(f(exit.value))
    }
  }
}
exports.forEach_ = forEach_
var core_1 = require("./core")
Object.defineProperty(exports, "succeed", {
  enumerable: true,
  get: function () {
    return core_1.succeed
  }
})
Object.defineProperty(exports, "Success", {
  enumerable: true,
  get: function () {
    return core_1.Success
  }
})
Object.defineProperty(exports, "Failure", {
  enumerable: true,
  get: function () {
    return core_1.Failure
  }
})
Object.defineProperty(exports, "halt", {
  enumerable: true,
  get: function () {
    return core_1.halt
  }
})
Object.defineProperty(exports, "ap", {
  enumerable: true,
  get: function () {
    return core_1.ap
  }
})
Object.defineProperty(exports, "as", {
  enumerable: true,
  get: function () {
    return core_1.as
  }
})
Object.defineProperty(exports, "chain", {
  enumerable: true,
  get: function () {
    return core_1.chain
  }
})
Object.defineProperty(exports, "collectAll", {
  enumerable: true,
  get: function () {
    return core_1.collectAll
  }
})
Object.defineProperty(exports, "flatten", {
  enumerable: true,
  get: function () {
    return core_1.flatten
  }
})
Object.defineProperty(exports, "fold", {
  enumerable: true,
  get: function () {
    return core_1.fold
  }
})
Object.defineProperty(exports, "interrupt", {
  enumerable: true,
  get: function () {
    return core_1.interrupt
  }
})
Object.defineProperty(exports, "interrupted", {
  enumerable: true,
  get: function () {
    return core_1.interrupted
  }
})
Object.defineProperty(exports, "map", {
  enumerable: true,
  get: function () {
    return core_1.map
  }
})
Object.defineProperty(exports, "mapErrorCause", {
  enumerable: true,
  get: function () {
    return core_1.mapErrorCause
  }
})
Object.defineProperty(exports, "zipWith", {
  enumerable: true,
  get: function () {
    return core_1.zipWith
  }
})
Object.defineProperty(exports, "bimap", {
  enumerable: true,
  get: function () {
    return core_1.bimap
  }
})
Object.defineProperty(exports, "chain_", {
  enumerable: true,
  get: function () {
    return core_1.chain_
  }
})
Object.defineProperty(exports, "collectAllPar", {
  enumerable: true,
  get: function () {
    return core_1.collectAllPar
  }
})
Object.defineProperty(exports, "die", {
  enumerable: true,
  get: function () {
    return core_1.die
  }
})
Object.defineProperty(exports, "exists", {
  enumerable: true,
  get: function () {
    return core_1.exists
  }
})
Object.defineProperty(exports, "fail", {
  enumerable: true,
  get: function () {
    return core_1.fail
  }
})
Object.defineProperty(exports, "fold_", {
  enumerable: true,
  get: function () {
    return core_1.fold_
  }
})
Object.defineProperty(exports, "fromEither", {
  enumerable: true,
  get: function () {
    return core_1.fromEither
  }
})
Object.defineProperty(exports, "fromOption", {
  enumerable: true,
  get: function () {
    return core_1.fromOption
  }
})
Object.defineProperty(exports, "getOrElse", {
  enumerable: true,
  get: function () {
    return core_1.getOrElse
  }
})
Object.defineProperty(exports, "mapError", {
  enumerable: true,
  get: function () {
    return core_1.mapError
  }
})
Object.defineProperty(exports, "map_", {
  enumerable: true,
  get: function () {
    return core_1.map_
  }
})
Object.defineProperty(exports, "orElseFail", {
  enumerable: true,
  get: function () {
    return core_1.orElseFail
  }
})
Object.defineProperty(exports, "succeeded", {
  enumerable: true,
  get: function () {
    return core_1.succeeded
  }
})
Object.defineProperty(exports, "toEither", {
  enumerable: true,
  get: function () {
    return core_1.toEither
  }
})
Object.defineProperty(exports, "unit", {
  enumerable: true,
  get: function () {
    return core_1.unit
  }
})
Object.defineProperty(exports, "zip", {
  enumerable: true,
  get: function () {
    return core_1.zip
  }
})
Object.defineProperty(exports, "zipLeft", {
  enumerable: true,
  get: function () {
    return core_1.zipLeft
  }
})
Object.defineProperty(exports, "zipPar", {
  enumerable: true,
  get: function () {
    return core_1.zipPar
  }
})
Object.defineProperty(exports, "zipParLeft", {
  enumerable: true,
  get: function () {
    return core_1.zipParLeft
  }
})
Object.defineProperty(exports, "zipParRight", {
  enumerable: true,
  get: function () {
    return core_1.zipParRight
  }
})
Object.defineProperty(exports, "zipRight", {
  enumerable: true,
  get: function () {
    return core_1.zipRight
  }
})
Object.defineProperty(exports, "zipRight_", {
  enumerable: true,
  get: function () {
    return core_1.zipRight_
  }
})
Object.defineProperty(exports, "zipWith_", {
  enumerable: true,
  get: function () {
    return core_1.zipWith_
  }
})
//# sourceMappingURL=api.js.map
