import * as Chunk from "../Collections/Immutable/Chunk/core.js";
import type { Exit } from "../Exit/index.js";
import type { FiberContext } from "../Fiber/context.js";
import type * as Fiber from "../Fiber/core.js";
import type { Managed } from "../Managed/managed.js";
import type { ReleaseMap } from "../Managed/ReleaseMap/index.js";
import * as O from "../Option/index.js";
import type { Promise } from "../Promise/index.js";
import * as Q from "../Queue/core.js";
import { AtomicBoolean } from "../Support/AtomicBoolean/index.js";
import type { MutableQueue } from "../Support/MutableQueue/index.js";
import type { Effect, UIO } from "./effect.js";
import type { ExecutionStrategy } from "./ExecutionStrategy.js";
/**
* Applies the function `f` to each element of the `Iterable` and
* returns the results in a new `readonly B[]`.
*
* For a parallel version of this method, see `forEachPar`.
* If you do not need the results, see `forEachUnit` for a more efficient implementation.
*/
export declare function forEach_(as: Iterable, f: (a: A) => Effect, __trace?: string): Effect>;
/**
* Same as `forEach_`, except that the function `f` is supplied
* a second argument that corresponds to the index (starting from 0)
* of the current element being iterated over.
*/
export declare function forEachWithIndex_(as: Iterable, f: (a: A, i: number) => Effect, __trace?: string): Effect>;
/**
* Applies the function `f` to each element of the `Iterable` and
* returns the results in a new `readonly B[]`.
*
* For a parallel version of this method, see `forEachPar`.
* If you do not need the results, see `forEachUnit` for a more efficient implementation.
*
* @ets_data_first forEach_
*/
export declare function forEach(f: (a: A) => Effect, __trace?: string): (as: Iterable) => Effect>;
/**
* Same as `forEach`, except that the function `f` is supplied
* a second argument that corresponds to the index (starting from 0)
* of the current element being iterated over.
*
* @ets_data_first forEachWithIndex_
*/
export declare function forEachWithIndex(f: (a: A, i: number) => Effect, __trace?: string): (as: Iterable) => Effect>;
/**
* Applies the function `f` to each element of the `Iterable` and runs
* produced effects sequentially.
*
* Equivalent to `asUnit(forEach(as, f))`, but without the cost of building
* the list of results.
*/
export declare function forEachUnit_(as: Iterable, f: (a: A) => Effect, __trace?: string): Effect;
/**
* Applies the function `f` to each element of the `Iterable` and runs
* produced effects sequentially.
*
* Equivalent to `asUnit(forEach(as, f))`, but without the cost of building
* the list of results.
*
* @ets_data_first forEachUnit_
*/
export declare function forEachUnit(f: (a: A) => Effect, __trace?: string): (as: Iterable) => Effect;
/**
* Applies the function `f` to each element of the `Iterable` and runs
* produced effects in parallel, discarding the results.
*
* For a sequential version of this method, see `forEach_`.
*
* Optimized to avoid keeping full tree of effects, so that method could be
* able to handle large input sequences.
* Behaves almost like this code:
*
* Additionally, interrupts all effects on any failure.
*/
export declare function forEachUnitPar_(as: Iterable, f: (a: A) => Effect, __trace?: string): Effect;
/**
* Forks the fiber in a `Managed`. Using the `Managed` value will
* execute the effect in the fiber, while ensuring its interruption when
* the effect supplied to `use` completes.
*/
export declare function forkManaged(self: Effect, __trace?: string): Managed>;
/**
* Applies the function `f` to each element of the `Iterable` and runs
* produced effects in parallel, discarding the results.
*
* For a sequential version of this method, see `forEach_`.
*
* Optimized to avoid keeping full tree of effects, so that method could be
* able to handle large input sequences.
* Behaves almost like this code:
*
* Additionally, interrupts all effects on any failure.
*
* @ets_data_first forEachUnitPar_
*/
export declare function forEachUnitPar(f: (a: A) => Effect, __trace?: string): (as: Iterable) => Effect;
/**
* Applies the function `f` to each element of the `Iterable` in parallel,
* and returns the results in a new `readonly B[]`.
*
* For a sequential version of this method, see `forEach`.
*/
export declare function forEachPar_(as: Iterable, f: (a: A) => Effect, __trace?: string): Effect>;
/**
* Same as `forEachPar_`, except that the function `f` is supplied
* a second argument that corresponds to the index (starting from 0)
* of the current element being iterated over.
*/
export declare function forEachParWithIndex_(as: Iterable, f: (a: A, i: number) => Effect, __trace?: string): Effect>;
/**
* Applies the function `f` to each element of the `Iterable` in parallel,
* and returns the results in a new `readonly B[]`.
*
* For a sequential version of this method, see `forEach`.
*
* @ets_data_first forEachPar_
*/
export declare function forEachPar(f: (a: A) => Effect, __trace?: string): (as: Iterable) => Effect>;
/**
* Same as `forEachPar`, except that the function `f` is supplied
* a second argument that corresponds to the index (starting from 0)
* of the current element being iterated over.
*/
export declare function forEachParWithIndex(f: (a: A, i: number) => Effect, __trace?: string): (as: Iterable) => Effect>;
/**
* Applies the function `f` to each element of the `Iterable[A]` and runs
* produced effects in parallel, discarding the results.
*
* Unlike `forEachUnitPar_`, this method will use at most up to `n` fibers.
*/
export declare function forEachUnitParN_(as: Iterable, n: number, f: (a: A) => Effect, __trace?: string): Effect;
/**
* Applies the function `f` to each element of the `Iterable[A]` and runs
* produced effects in parallel, discarding the results.
*
* Unlike `forEachUnitPar_`, this method will use at most up to `n` fibers.
*
* @ets_data_first forEachUnitParN_
*/
export declare function forEachUnitParN(n: number, f: (a: A) => Effect, __trace?: string): (as: Iterable) => Effect;
/**
* Applies the functionw `f` to each element of the `Iterable` in parallel,
* and returns the results in a new `readonly B[]`.
*
* Unlike `forEachPar`, this method will use at most up to `n` fibers.
*/
export declare function forEachParN_(as: Iterable, n: number, f: (a: A) => Effect, __trace?: string): Effect>;
/**
* Same as `forEachParN_`, except that the function `f` is supplied
* a second argument that corresponds to the index (starting from 0)
* of the current element being iterated over.
*/
export declare function forEachParWithIndexN_(as: Iterable, n: number, f: (a: A, i: number) => Effect, __trace?: string): Effect>;
/**
* Applies the functionw `f` to each element of the `Iterable` in parallel,
* and returns the results in a new `readonly B[]`.
*
* Unlike `forEachPar`, this method will use at most up to `n` fibers.
*
* @ets_data_first forEachParN_
*/
export declare function forEachParN(n: number, f: (a: A) => Effect, __trace?: string): (as: Iterable) => Effect>;
/**
* Same as `forEachParN`, except that the function `f` is supplied
* a second argument that corresponds to the index (starting from 0)
* of the current element being iterated over.
*
* @ets_data_first forEachParWithIndexN_
*/
export declare function forEachParWithIndexN(n: number, f: (a: A, i: number) => Effect, __trace?: string): (as: Iterable) => Effect>;
/**
* Applies the function `f` to each element of the `Iterable` in parallel,
* and returns the results in a new `readonly B[]`.
*
* For a sequential version of this method, see `forEach`.
*/
export declare function forEachExec_(as: Iterable, es: ExecutionStrategy, f: (a: A) => Effect, __trace?: string): Effect>;
/**
* Applies the function `f` to each element of the `Iterable` in parallel,
* and returns the results in a new `readonly B[]`.
*
* For a sequential version of this method, see `forEach`.
*
* @ets_data_first forEachExec_
*/
export declare function forEachExec(es: ExecutionStrategy, f: (a: A) => Effect, __trace?: string): (as: Iterable) => Effect>;
/**
* Evaluate each effect in the structure from left to right, and collect the
* results. For a parallel version, see `collectAllPar`.
*/
export declare function collectAll(as: Iterable>, __trace?: string): Effect>;
/**
* Evaluate each effect in the structure in parallel, and collect the
* results. For a sequential version, see `collectAll`.
*/
export declare function collectAllPar(as: Iterable>, __trace?: string): Effect>;
/**
* Evaluate each effect in the structure in parallel, and collect the
* results. For a sequential version, see `collectAll`.
*
* Unlike `collectAllPar`, this method will use at most `n` fibers.
*
* @ets_data_first collectAllParN_
*/
export declare function collectAllParN(n: number, __trace?: string): (as: Iterable>) => Effect>;
/**
* Evaluate each effect in the structure in parallel, and collect the
* results. For a sequential version, see `collectAll`.
*
* Unlike `collectAllPar`, this method will use at most `n` fibers.
*/
export declare function collectAllParN_(as: Iterable>, n: number, __trace?: string): Effect>;
/**
* Evaluate each effect in the structure from left to right, and discard the
* results. For a parallel version, see `collectAllUnitPar`.
*/
export declare function collectAllUnit(as: Iterable>, __trace?: string): Effect;
/**
* Evaluate each effect in the structure in parallel, and discard the
* results. For a sequential version, see `collectAllUnit`.
*/
export declare function collectAllUnitPar(as: Iterable>, __trace?: string): Effect;
/**
* Evaluate each effect in the structure in parallel, and discard the
* results. For a sequential version, see `collectAllUnit`.
*
* Unlike `collectAllUnitPar`, this method will use at most `n` fibers.
*
* @ets_data_first collectAllUnitParN_
*/
export declare function collectAllUnitParN(n: number, __trace?: string): (as: Iterable>) => Effect;
/**
* Evaluate each effect in the structure in parallel, and discard the
* results. For a sequential version, see `collectAllUnit`.
*
* Unlike `collectAllUnitPar`, this method will use at most `n` fibers.
*/
export declare function collectAllUnitParN_(as: Iterable>, n: number, __trace?: string): Effect;
/**
* Evaluate each effect in the structure with `collectAll`, and collect
* the results with given partial function.
*/
export declare function collectAllWith_(as: Iterable>, pf: (a: A) => O.Option, __trace?: string): Effect>;
/**
* Evaluate each effect in the structure with `collectAll`, and collect
* the results with given partial function.
*
* @ets_data_first collectAllWith_
*/
export declare function collectAllWith(pf: (a: A) => O.Option, __trace?: string): (as: Iterable>) => Effect>;
/**
* Evaluate each effect in the structure with `collectAll`, and collect
* the results with given partial function.
*/
export declare function collectAllWithPar_(as: Iterable>, pf: (a: A) => O.Option, __trace?: string): Effect>;
/**
* Evaluate each effect in the structure with `collectAll`, and collect
* the results with given partial function.
*
* @ets_data_first collectAllWithPar_
*/
export declare function collectAllWithPar(pf: (a: A) => O.Option, __trace?: string): (as: Iterable>) => Effect>;
/**
* Evaluate each effect in the structure with `collectAllPar`, and collect
* the results with given partial function.
*
* Unlike `collectAllWithPar`, this method will use at most up to `n` fibers.
*/
export declare function collectAllWithParN_(as: Iterable>, n: number, pf: (a: A) => O.Option, __trace?: string): Effect>;
/**
* Evaluate each effect in the structure with `collectAllPar`, and collect
* the results with given partial function.
*
* Unlike `collectAllWithPar`, this method will use at most up to `n` fibers.
*
* @ets_data_first collectAllWithParN_
*/
export declare function collectAllWithParN(n: number, pf: (a: A) => O.Option, __trace?: string): (as: Iterable>) => Effect>;
/**
* Evaluate and run each effect in the structure and collect discarding failed ones.
*/
export declare function collectAllSuccesses(as: Iterable>, __trace?: string): Effect>;
/**
* Evaluate and run each effect in the structure in parallel, and collect discarding failed ones.
*/
export declare function collectAllSuccessesPar(as: Iterable>, __trace?: string): Effect>;
/**
* Evaluate and run each effect in the structure in parallel, and collect discarding failed ones.
*
* Unlike `collectAllSuccessesPar`, this method will use at most up to `n` fibers.
*/
export declare function collectAllSuccessesParN_(as: Iterable>, n: number, __trace?: string): Effect>;
/**
* Evaluate and run each effect in the structure in parallel, and collect discarding failed ones.
*
* Unlike `collectAllSuccessesPar`, this method will use at most up to `n` fibers.
*
* @ets_data_first collectAllSuccessesParN_
*/
export declare function collectAllSuccessesParN(n: number, __trace?: string): (as: Iterable>) => Effect>;
/**
* Joins all fibers, awaiting their _successful_ completion.
* Attempting to join a fiber that has erred will result in
* a catchable error, _if_ that error does not result from interruption.
*/
export declare function fiberJoinAll(as: Iterable>, __trace?: string): Effect>;
/**
* Awaits on all fibers to be completed, successfully or not.
*/
export declare function fiberWaitAll(as: Iterable>, __trace?: string): Effect>>;
/**
* Releases all the finalizers in the releaseMap according to the ExecutionStrategy
*/
export declare function releaseMapReleaseAll(exit: Exit, execStrategy: ExecutionStrategy, __trace?: string): (_: ReleaseMap) => UIO;
/**
* Creates a `Managed` value that acquires the original resource in a fiber,
* and provides that fiber. The finalizer for this value will interrupt the fiber
* and run the original finalizer.
*/
export declare function managedFork(self: Managed, __trace?: string): Managed>;
/**
* Run an effect while acquiring the resource before and releasing it after
*/
export declare function managedUse_(self: Managed, f: (a: A) => Effect, __trace?: string): Effect;
export declare class BackPressureStrategy implements Q.Strategy {
private putters;
handleSurplus(as: Chunk.Chunk, queue: MutableQueue, takers: MutableQueue>, isShutdown: AtomicBoolean): UIO;
unsafeRemove(p: Promise): void;
unsafeOffer(as: Chunk.Chunk, p: Promise): void;
unsafeOnQueueEmptySpace(queue: MutableQueue, takers: MutableQueue>): void;
get shutdown(): UIO;
get surplusSize(): number;
}
/**
* Creates a bounded queue
*/
export declare function makeBoundedQueue(capacity: number, __trace?: string): UIO>;
/**
* Unsafely creates a queue
*/
export declare function unsafeCreateQueue(queue: MutableQueue, takers: MutableQueue>, shutdownHook: Promise, shutdownFlag: AtomicBoolean, strategy: Q.Strategy): Q.Queue;
/**
* Creates a queue
*/
export declare function createQueue_(queue: MutableQueue, strategy: Q.Strategy, __trace?: string): Effect>;
/**
* Creates a queue
*
* @ets_data_first createQueue_
*/
export declare function createQueue(strategy: Q.Strategy, __trace?: string): (queue: MutableQueue) => Effect>;
//# sourceMappingURL=excl-forEach.d.ts.map