"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mapMPartitioned = void 0;
const groupByKey_1 = require("./groupByKey");
const mapM_1 = require("./mapM");
/**
 * Maps over elements of the stream with the specified effectful function,
 * partitioned by `p` executing invocations of `f` concurrently. The number
 * of concurrent invocations of `f` is determined by the number of different
 * outputs of type `K`. Up to `buffer` elements may be buffered per partition.
 * Transformed elements may be reordered but the order within a partition is maintained.
 */
function mapMPartitioned(keyBy, f, buffer = 16) {
    return (self) => (0, groupByKey_1.groupByKey_)(self, keyBy, buffer).merge((_, s) => (0, mapM_1.mapM_)(s, f));
}
exports.mapMPartitioned = mapMPartitioned;
//# sourceMappingURL=mapMPartitioned.js.map