"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
exports.parallelErrors = void 0
const Cause_1 = require("../Cause")
const core_1 = require("./core")
const fail_1 = require("./fail")
/**
 * Exposes all parallel errors in a single call
 */
function parallelErrors(self, __trace) {
  return (0, core_1.foldCauseM_)(
    self,
    (cause) => {
      const f = (0, Cause_1.failures)(cause)
      if (f.length === 0) {
        return (0, core_1.halt)(cause)
      } else {
        return (0, fail_1.fail)(f)
      }
    },
    core_1.succeed,
    __trace
  )
}
exports.parallelErrors = parallelErrors
//# sourceMappingURL=parallelErrors.js.map
