import * as tsplus_module_1 from "@tsplus/stdlib/data/Either/definition";
import * as tsplus_module_2 from "@effect/core/io/Effect/operations/succeedNow";
import * as tsplus_module_3 from "@effect/core/stream/Stream/operations/partitionEither";
/**
 * Partition a stream using a predicate. The first stream will contain all
 * element evaluated to true and the second one will contain all element
 * evaluated to false. The faster stream may advance by up to buffer elements
 * further than the slower one.
 *
 * @tsplus fluent ets/Stream partition
 */

export function partition_(self, p, buffer = 16, __tsplusTrace) {
  return tsplus_module_3.partitionEither_(self, a => p(a) ? tsplus_module_2.succeedNow(tsplus_module_1.left(a), __tsplusTrace) : tsplus_module_2.succeedNow(tsplus_module_1.right(a), __tsplusTrace), buffer, __tsplusTrace);
}
/**
 * Partition a stream using a predicate. The first stream will contain all
 * element evaluated to true and the second one will contain all element
 * evaluated to false. The faster stream may advance by up to buffer elements
 * further than the slower one.
 *
 * @tsplus static ets/Stream/Aspects partition
 */

export const partition = (p, buffer = 16, __tsplusTrace) => self => partition_(self, p, buffer, __tsplusTrace);
//# sourceMappingURL=partition.mjs.map