"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
exports.mapNParN_ =
  exports.mapNParN =
  exports.mapNPar_ =
  exports.mapNPar =
  exports.mapN_ =
  exports.mapN =
    void 0
const core_1 = require("../core")
const tuple_1 = require("../tuple")
/**
 * Sequentially zips the specified effects using the specified combiner
 * function.
 *
 * @dataFirst mapN_
 */
function mapN(f, __trace) {
  return (t) => mapN_(t, f, __trace)
}
exports.mapN = mapN
/**
 * Sequentially zips the specified effects using the specified combiner
 * function.
 */
function mapN_(t, f, __trace) {
  // @ts-expect-error
  return (0, core_1.map_)((0, tuple_1.tuple)(...t.tuple), (x) => f(...x), __trace)
}
exports.mapN_ = mapN_
/**
 * Zips the specified effects in parallel using the specified combiner
 * function.
 *
 * @dataFirst mapNPar_
 */
function mapNPar(f, __trace) {
  return (t) => mapNPar_(t, f, __trace)
}
exports.mapNPar = mapNPar
/**
 * Zips the specified effects in parallel using the specified combiner
 * function.
 */
function mapNPar_(t, f, __trace) {
  // @ts-expect-error
  return (0, core_1.map_)(
    (0, tuple_1.tuplePar)(...t.tuple),
    (x) => f(...x.tuple),
    __trace
  )
}
exports.mapNPar_ = mapNPar_
/**
 * Zips the specified effects in parallel using the specified combiner
 * function.
 *
 * This variant uses up to N fibers.
 *
 * @dataFitst mapNParN_
 */
function mapNParN(n, f, __trace) {
  return (t) => mapNParN_(t, n, f, __trace)
}
exports.mapNParN = mapNParN
/**
 * Zips the specified effects in parallel using the specified combiner
 * function.
 *
 * This variant uses up to N fibers.
 */
function mapNParN_(t, n, f, __trace) {
  // @ts-expect-error
  return (0, core_1.map_)(
    (0, tuple_1.tupleParN)(n)(...t.tuple),
    (x) => f(...x.tuple),
    __trace
  )
}
exports.mapNParN_ = mapNParN_
//# sourceMappingURL=mapN.js.map
