/** * @since 1.0.0 */ import type * as Chunk from "@effect/data/Chunk"; import type * as Context from "@effect/data/Context"; import type * as Duration from "@effect/data/Duration"; import type * as Either from "@effect/data/Either"; import type { LazyArg } from "@effect/data/Function"; import type * as HashMap from "@effect/data/HashMap"; import type * as HashSet from "@effect/data/HashSet"; import type * as Option from "@effect/data/Option"; import type { Pipeable } from "@effect/data/Pipeable"; import type { Predicate, Refinement } from "@effect/data/Predicate"; import type * as Unify from "@effect/data/Unify"; import type * as Cause from "@effect/io/Cause"; import type * as Effect from "@effect/io/Effect"; import type * as Exit from "@effect/io/Exit"; import type * as Hub from "@effect/io/Hub"; import type * as Queue from "@effect/io/Queue"; import type * as Scope from "@effect/io/Scope"; import type * as Channel from "@effect/stream/Channel"; import type * as MergeDecision from "@effect/stream/Channel/MergeDecision"; /** * @since 1.0.0 * @category symbols */ export declare const SinkTypeId: unique symbol; /** * @since 1.0.0 * @category symbols */ export type SinkTypeId = typeof SinkTypeId; /** * A `Sink` is used to consume elements produced by a `Stream`. * You can think of a sink as a function that will consume a variable amount of * `In` elements (could be 0, 1, or many), might fail with an error of type `E`, * and will eventually yield a value of type `Z` together with a remainder of * type `L` (i.e. any leftovers). * * @since 1.0.0 * @category models */ export interface Sink extends Sink.Variance, Pipeable { } /** * @since 1.0.0 * @category models */ export interface SinkUnify extends Effect.EffectUnify { Sink?: () => A[Unify.typeSymbol] extends Sink | infer _ ? Sink : never; } /** * @category models * @since 1.0.0 */ export interface SinkUnifyBlacklist extends Effect.EffectUnifyBlacklist { Sink?: true; } /** * @since 1.0.0 * @category models */ declare module "@effect/io/Effect" { interface Effect extends Sink { } interface EffectUnifyBlacklist { Sink?: true; } } /** * @since 1.0.0 */ export declare namespace Sink { /** * @since 1.0.0 * @category models */ interface Variance { readonly [SinkTypeId]: { _R: (_: never) => R; _E: (_: never) => E; _In: (_: In) => void; _L: (_: never) => L; _Z: (_: never) => Z; }; } } /** * Replaces this sink's result with the provided value. * * @since 1.0.0 * @category mapping */ export declare const as: { (z: Z2): (self: Sink) => Sink; (self: Sink, z: Z2): Sink; }; /** * A sink that collects all elements into a `Chunk`. * * @since 1.0.0 * @category constructors */ export declare const collectAll: () => Sink>; /** * A sink that collects first `n` elements into a chunk. * * @since 1.0.0 * @category constructors */ export declare const collectAllN: (n: number) => Sink>; /** * Repeatedly runs the sink and accumulates its results into a `Chunk`. * * @since 1.0.0 * @category utils */ export declare const collectAllFrom: (self: Sink) => Sink>; /** * A sink that collects all of its inputs into a map. The keys are extracted * from inputs using the keying function `key`; if multiple inputs use the * same key, they are merged using the `merge` function. * * @since 1.0.0 * @category constructors */ export declare const collectAllToMap: (key: (input: In) => K, merge: (x: In, y: In) => In) => Sink>; /** * A sink that collects first `n` keys into a map. The keys are calculated * from inputs using the keying function `key`; if multiple inputs use the the * same key, they are merged using the `merge` function. * * @since 1.0.0 * @category constructors */ export declare const collectAllToMapN: (n: number, key: (input: In) => K, merge: (x: In, y: In) => In) => Sink>; /** * A sink that collects all of its inputs into a set. * * @since 1.0.0 * @category constructors */ export declare const collectAllToSet: () => Sink>; /** * A sink that collects first `n` distinct inputs into a set. * * @since 1.0.0 * @category constructors */ export declare const collectAllToSetN: (n: number) => Sink>; /** * Accumulates incoming elements into a chunk until predicate `p` is * satisfied. * * @since 1.0.0 * @category constructors */ export declare const collectAllUntil: (p: Predicate) => Sink>; /** * Accumulates incoming elements into a chunk until effectful predicate `p` is * satisfied. * * @since 1.0.0 * @category constructors */ export declare const collectAllUntilEffect: (p: (input: In) => Effect.Effect) => Sink>; /** * Accumulates incoming elements into a chunk as long as they verify predicate * `p`. * * @since 1.0.0 * @category constructors */ export declare const collectAllWhile: (predicate: Predicate) => Sink>; /** * Accumulates incoming elements into a chunk as long as they verify effectful * predicate `p`. * * @since 1.0.0 * @category constructors */ export declare const collectAllWhileEffect: (predicate: (input: In) => Effect.Effect) => Sink>; /** * Repeatedly runs the sink for as long as its results satisfy the predicate * `p`. The sink's results will be accumulated using the stepping function `f`. * * @since 1.0.0 * @category utils */ export declare const collectAllWhileWith: { (options: { readonly initial: S; readonly while: Predicate; readonly body: (s: S, z: Z) => S; }): (self: Sink) => Sink; (self: Sink, options: { readonly initial: S; readonly while: Predicate; readonly body: (s: S, z: Z) => S; }): Sink; }; /** * Collects the leftovers from the stream when the sink succeeds and returns * them as part of the sink's result. * * @since 1.0.0 * @category utils */ export declare const collectLeftover: (self: Sink) => Sink]>; /** * Transforms this sink's input elements. * * @since 1.0.0 * @category mapping */ export declare const mapInput: ((f: (input: In0) => In) => (self: Sink) => Sink) & ((self: Sink, f: (input: In0_1) => In_1) => Sink); /** * Effectfully transforms this sink's input elements. * * @since 1.0.0 * @category mapping */ export declare const mapInputEffect: ((f: (input: In0) => Effect.Effect) => (self: Sink) => Sink) & ((self: Sink, f: (input: In0_1) => Effect.Effect) => Sink); /** * Transforms this sink's input chunks. `f` must preserve chunking-invariance. * * @since 1.0.0 * @category mapping */ export declare const mapInputChunks: { (f: (chunk: Chunk.Chunk) => Chunk.Chunk): (self: Sink) => Sink; (self: Sink, f: (chunk: Chunk.Chunk) => Chunk.Chunk): Sink; }; /** * Effectfully transforms this sink's input chunks. `f` must preserve * chunking-invariance. * * @since 1.0.0 * @category mapping */ export declare const mapInputChunksEffect: { (f: (chunk: Chunk.Chunk) => Effect.Effect>): (self: Sink) => Sink; (self: Sink, f: (chunk: Chunk.Chunk) => Effect.Effect>): Sink; }; /** * A sink that counts the number of elements fed to it. * * @since 1.0.0 * @category constructors */ export declare const count: Sink; /** * Creates a sink halting with the specified defect. * * @since 1.0.0 * @category constructors */ export declare const die: (defect: unknown) => Sink; /** * Creates a sink halting with the specified message, wrapped in a * `RuntimeException`. * * @since 1.0.0 * @category constructors */ export declare const dieMessage: (message: string) => Sink; /** * Creates a sink halting with the specified defect. * * @since 1.0.0 * @category constructors */ export declare const dieSync: (evaluate: LazyArg) => Sink; /** * Transforms both inputs and result of this sink using the provided * functions. * * @since 1.0.0 * @category mapping */ export declare const dimap: { (options: { readonly onInput: (input: In0) => In; readonly onDone: (z: Z) => Z2; }): (self: Sink) => Sink; (self: Sink, options: { readonly onInput: (input: In0) => In; readonly onDone: (z: Z) => Z2; }): Sink; }; /** * Effectfully transforms both inputs and result of this sink using the * provided functions. * * @since 1.0.0 * @category mapping */ export declare const dimapEffect: { (options: { readonly onInput: (input: In0) => Effect.Effect; readonly onDone: (z: Z) => Effect.Effect; }): (self: Sink) => Sink; (self: Sink, options: { readonly onInput: (input: In0) => Effect.Effect; readonly onDone: (z: Z) => Effect.Effect; }): Sink; }; /** * Transforms both input chunks and result of this sink using the provided * functions. * * @since 1.0.0 * @category mapping */ export declare const dimapChunks: { (options: { readonly onInput: (chunk: Chunk.Chunk) => Chunk.Chunk; readonly onDone: (z: Z) => Z2; }): (self: Sink) => Sink; (self: Sink, options: { readonly onInput: (chunk: Chunk.Chunk) => Chunk.Chunk; readonly onDone: (z: Z) => Z2; }): Sink; }; /** * Effectfully transforms both input chunks and result of this sink using the * provided functions. `f` and `g` must preserve chunking-invariance. * * @since 1.0.0 * @category mapping */ export declare const dimapChunksEffect: { (options: { readonly onInput: (chunk: Chunk.Chunk) => Effect.Effect>; readonly onDone: (z: Z) => Effect.Effect; }): (self: Sink) => Sink; (self: Sink, options: { readonly onInput: (chunk: Chunk.Chunk) => Effect.Effect>; readonly onDone: (z: Z) => Effect.Effect; }): Sink; }; /** * A sink that ignores its inputs. * * @since 1.0.0 * @category constructors */ export declare const drain: Sink; /** * Creates a sink that drops `n` elements. * * @since 1.0.0 * @category constructors */ export declare const drop: (n: number) => Sink; /** * Drops incoming elements until the predicate is satisfied. * * @since 1.0.0 * @category constructors */ export declare const dropUntil: (predicate: Predicate) => Sink; /** * Drops incoming elements until the effectful predicate is satisfied. * * @since 1.0.0 * @category constructors */ export declare const dropUntilEffect: (predicate: (input: In) => Effect.Effect) => Sink; /** * Drops incoming elements as long as the predicate is satisfied. * * @since 1.0.0 * @category constructors */ export declare const dropWhile: (predicate: Predicate) => Sink; /** * Drops incoming elements as long as the effectful predicate is satisfied. * * @since 1.0.0 * @category constructors */ export declare const dropWhileEffect: (predicate: (input: In) => Effect.Effect) => Sink; /** * Returns a new sink with an attached finalizer. The finalizer is guaranteed * to be executed so long as the sink begins execution (and regardless of * whether or not it completes). * * @since 1.0.0 * @category finalization */ export declare const ensuring: { (finalizer: Effect.Effect): (self: Sink) => Sink; (self: Sink, finalizer: Effect.Effect): Sink; }; /** * Returns a new sink with an attached finalizer. The finalizer is guaranteed * to be executed so long as the sink begins execution (and regardless of * whether or not it completes). * * @since 1.0.0 * @category finalization */ export declare const ensuringWith: { (finalizer: (exit: Exit.Exit) => Effect.Effect): (self: Sink) => Sink; (self: Sink, finalizer: (exit: Exit.Exit) => Effect.Effect): Sink; }; /** * Accesses the whole context of the sink. * * @since 1.0.0 * @category constructors */ export declare const context: () => Sink>; /** * Accesses the context of the sink. * * @since 1.0.0 * @category constructors */ export declare const contextWith: (f: (context: Context.Context) => Z) => Sink; /** * Accesses the context of the sink in the context of an effect. * * @since 1.0.0 * @category constructors */ export declare const contextWithEffect: (f: (context: Context.Context) => Effect.Effect) => Sink; /** * Accesses the context of the sink in the context of a sink. * * @since 1.0.0 * @category constructors */ export declare const contextWithSink: (f: (context: Context.Context) => Sink) => Sink; /** * A sink that returns whether all elements satisfy the specified predicate. * * @since 1.0.0 * @category constructors */ export declare const every: (predicate: Predicate) => Sink; /** * A sink that always fails with the specified error. * * @since 1.0.0 * @category constructors */ export declare const fail: (e: E) => Sink; /** * A sink that always fails with the specified lazily evaluated error. * * @since 1.0.0 * @category constructors */ export declare const failSync: (evaluate: LazyArg) => Sink; /** * Creates a sink halting with a specified `Cause`. * * @since 1.0.0 * @category constructors */ export declare const failCause: (cause: Cause.Cause) => Sink; /** * Creates a sink halting with a specified lazily evaluated `Cause`. * * @since 1.0.0 * @category constructors */ export declare const failCauseSync: (evaluate: LazyArg>) => Sink; /** * Filters the sink's input with the given predicate. * * @since 1.0.0 * @category filtering */ export declare const filterInput: { (f: Refinement): (self: Sink) => Sink; (f: Predicate): (self: Sink) => Sink; }; /** * Effectfully filter the input of this sink using the specified predicate. * * @since 1.0.0 * @category filtering */ export declare const filterInputEffect: { (f: (input: In1) => Effect.Effect): (self: Sink) => Sink; (self: Sink, f: (input: In1) => Effect.Effect): Sink; }; /** * Creates a sink that produces values until one verifies the predicate `f`. * * @since 1.0.0 * @category elements */ export declare const findEffect: { (f: (z: Z) => Effect.Effect): (self: Sink) => Sink>; (self: Sink, f: (z: Z) => Effect.Effect): Sink>; }; /** * A sink that folds its inputs with the provided function, termination * predicate and initial state. * * @since 1.0.0 * @category folding */ export declare const fold: (s: S, contFn: Predicate, f: (z: S, input: In) => S) => Sink; /** * Folds over the result of the sink * * @since 1.0.0 * @category folding */ export declare const foldSink: { (options: { readonly onFailure: (err: E) => Sink; readonly onSuccess: (z: Z) => Sink; }): (self: Sink) => Sink; (self: Sink, options: { readonly onFailure: (err: E) => Sink; readonly onSuccess: (z: Z) => Sink; }): Sink; }; /** * A sink that folds its input chunks with the provided function, termination * predicate and initial state. `contFn` condition is checked only for the * initial value and at the end of processing of each chunk. `f` and `contFn` * must preserve chunking-invariance. * * @since 1.0.0 * @category constructors */ export declare const foldChunks: (s: S, contFn: Predicate, f: (s: S, chunk: Chunk.Chunk) => S) => Sink; /** * A sink that effectfully folds its input chunks with the provided function, * termination predicate and initial state. `contFn` condition is checked only * for the initial value and at the end of processing of each chunk. `f` and * `contFn` must preserve chunking-invariance. * * @since 1.0.0 * @category constructors */ export declare const foldChunksEffect: (s: S, contFn: Predicate, f: (s: S, chunk: Chunk.Chunk) => Effect.Effect) => Sink; /** * A sink that effectfully folds its inputs with the provided function, * termination predicate and initial state. * * @since 1.0.0 * @category constructors */ export declare const foldEffect: (s: S, contFn: Predicate, f: (s: S, input: In) => Effect.Effect) => Sink; /** * A sink that folds its inputs with the provided function and initial state. * * @since 1.0.0 * @category constructors */ export declare const foldLeft: (s: S, f: (s: S, input: In) => S) => Sink; /** * A sink that folds its input chunks with the provided function and initial * state. `f` must preserve chunking-invariance. * * @since 1.0.0 * @category constructors */ export declare const foldLeftChunks: (s: S, f: (s: S, chunk: Chunk.Chunk) => S) => Sink; /** * A sink that effectfully folds its input chunks with the provided function * and initial state. `f` must preserve chunking-invariance. * * @since 1.0.0 * @category constructors */ export declare const foldLeftChunksEffect: (s: S, f: (s: S, chunk: Chunk.Chunk) => Effect.Effect) => Sink; /** * A sink that effectfully folds its inputs with the provided function and * initial state. * * @since 1.0.0 * @category constructors */ export declare const foldLeftEffect: (s: S, f: (s: S, input: In) => Effect.Effect) => Sink; /** * Creates a sink that folds elements of type `In` into a structure of type * `S` until `max` elements have been folded. * * Like `Sink.foldWeighted`, but with a constant cost function of `1`. * * @since 1.0.0 * @category constructors */ export declare const foldUntil: (s: S, max: number, f: (z: S, input: In) => S) => Sink; /** * Creates a sink that effectfully folds elements of type `In` into a * structure of type `S` until `max` elements have been folded. * * Like `Sink.foldWeightedEffect` but with a constant cost function of `1`. * * @since 1.0.0 * @category constructors */ export declare const foldUntilEffect: (s: S, max: number, f: (s: S, input: In) => Effect.Effect) => Sink; /** * Creates a sink that folds elements of type `In` into a structure of type * `S`, until `max` worth of elements (determined by the `costFn`) have been * folded. * * @note * Elements that have an individual cost larger than `max` will force the * sink to cross the `max` cost. See `Sink.foldWeightedDecompose` for a * variant that can handle these cases. * * @since 1.0.0 * @category constructors */ export declare const foldWeighted: (options: { readonly initial: S; readonly maxCost: number; readonly cost: (s: S, input: In) => number; readonly body: (s: S, input: In) => S; }) => Sink; /** * Creates a sink that folds elements of type `In` into a structure of type * `S`, until `max` worth of elements (determined by the `costFn`) have been * folded. * * The `decompose` function will be used for decomposing elements that cause * an `S` aggregate to cross `max` into smaller elements. For example: * * ```ts * pipe( * Stream.make(1, 5, 1), * Stream.transduce( * Sink.foldWeightedDecompose( * Chunk.empty(), * 4, * (n: number) => n, * (n: number) => Chunk.make(n - 1, 1), * (acc, el) => pipe(acc, Chunk.append(el)) * ) * ), * Stream.runCollect * ) * ``` * * The stream would emit the elements `Chunk(1), Chunk(4), Chunk(1, 1)`. * * Be vigilant with this function, it has to generate "simpler" values or the * fold may never end. A value is considered indivisible if `decompose` yields * the empty chunk or a single-valued chunk. In these cases, there is no other * choice than to yield a value that will cross the threshold. * * `Sink.foldWeightedDecomposeEffect` allows the decompose function to return an * effect value, and consequently it allows the sink to fail. * * @since 1.0.0 * @category constructors */ export declare const foldWeightedDecompose: (options: { readonly initial: S; readonly maxCost: number; readonly cost: (s: S, input: In) => number; readonly decompose: (input: In) => Chunk.Chunk; readonly body: (s: S, input: In) => S; }) => Sink; /** * Creates a sink that effectfully folds elements of type `In` into a * structure of type `S`, until `max` worth of elements (determined by the * `costFn`) have been folded. * * The `decompose` function will be used for decomposing elements that cause * an `S` aggregate to cross `max` into smaller elements. Be vigilant with * this function, it has to generate "simpler" values or the fold may never * end. A value is considered indivisible if `decompose` yields the empty * chunk or a single-valued chunk. In these cases, there is no other choice * than to yield a value that will cross the threshold. * * See `Sink.foldWeightedDecompose` for an example. * * @since 1.0.0 * @category constructors */ export declare const foldWeightedDecomposeEffect: (options: { readonly initial: S; readonly maxCost: number; readonly cost: (s: S, input: In) => Effect.Effect; readonly decompose: (input: In) => Effect.Effect>; readonly body: (s: S, input: In) => Effect.Effect; }) => Sink; /** * Creates a sink that effectfully folds elements of type `In` into a * structure of type `S`, until `max` worth of elements (determined by the * `costFn`) have been folded. * * @note * Elements that have an individual cost larger than `max` will force the * sink to cross the `max` cost. See `Sink.foldWeightedDecomposeEffect` for * a variant that can handle these cases. * * @since 1.0.0 * @category constructors */ export declare const foldWeightedEffect: (options: { readonly initial: S; readonly maxCost: number; readonly cost: (s: S, input: In) => Effect.Effect; readonly body: (s: S, input: In) => Effect.Effect; }) => Sink; /** * A sink that executes the provided effectful function for every element fed * to it. * * @since 1.0.0 * @category constructors */ export declare const forEach: (f: (input: In) => Effect.Effect) => Sink; /** * A sink that executes the provided effectful function for every chunk fed to * it. * * @since 1.0.0 * @category constructors */ export declare const forEachChunk: (f: (input: Chunk.Chunk) => Effect.Effect) => Sink; /** * A sink that executes the provided effectful function for every chunk fed to * it until `f` evaluates to `false`. * * @since 1.0.0 * @category constructors */ export declare const forEachChunkWhile: (f: (input: Chunk.Chunk) => Effect.Effect) => Sink; /** * A sink that executes the provided effectful function for every element fed * to it until `f` evaluates to `false`. * * @since 1.0.0 * @category constructors */ export declare const forEachWhile: (f: (input: In) => Effect.Effect) => Sink; /** * Runs this sink until it yields a result, then uses that result to create * another sink from the provided function which will continue to run until it * yields a result. * * This function essentially runs sinks in sequence. * * @since 1.0.0 * @category sequencing */ export declare const flatMap: { (f: (z: Z) => Sink): (self: Sink) => Sink; (self: Sink, f: (z: Z) => Sink): Sink; }; /** * Creates a sink from a `Channel`. * * @since 1.0.0 * @category constructors */ export declare const fromChannel: (channel: Channel.Channel, unknown, E, Chunk.Chunk, Z>) => Sink; /** * Creates a `Channel` from a Sink. * * @since 1.0.0 * @category constructors */ export declare const toChannel: (self: Sink) => Channel.Channel, unknown, E, Chunk.Chunk, Z>; /** * Creates a single-value sink produced from an effect. * * @since 1.0.0 * @category constructors */ export declare const fromEffect: (effect: Effect.Effect) => Sink; /** * Create a sink which publishes each element to the specified hub. * * @param shutdown If `true`, the hub will be shutdown after the sink is evaluated (defaults to `false`) * @since 1.0.0 * @category constructors */ export declare const fromHub: (hub: Hub.Hub, options?: { readonly shutdown?: boolean; }) => Sink; /** * Creates a sink from a chunk processing function. * * @since 1.0.0 * @category constructors */ export declare const fromPush: (push: Effect.Effect>) => Effect.Effect, Chunk.Chunk], void>>) => Sink, E, In, L, Z>; /** * Create a sink which enqueues each element into the specified queue. * * @param shutdown If `true`, the queue will be shutdown after the sink is evaluated (defaults to `false`) * @since 1.0.0 * @category constructors */ export declare const fromQueue: (queue: Queue.Enqueue, options?: { readonly shutdown?: boolean; }) => Sink; /** * Creates a sink containing the first value. * * @since 1.0.0 * @category constructors */ export declare const head: () => Sink>; /** * Drains the remaining elements from the stream after the sink finishes * * @since 1.0.0 * @category utils */ export declare const ignoreLeftover: (self: Sink) => Sink; /** * Creates a sink containing the last value. * * @since 1.0.0 * @category constructors */ export declare const last: () => Sink>; /** * Creates a sink that does not consume any input but provides the given chunk * as its leftovers * * @since 1.0.0 * @category constructors */ export declare const leftover: (chunk: Chunk.Chunk) => Sink; /** * Transforms this sink's result. * * @since 1.0.0 * @category mapping */ export declare const map: { (f: (z: Z) => Z2): (self: Sink) => Sink; (self: Sink, f: (z: Z) => Z2): Sink; }; /** * Effectfully transforms this sink's result. * * @since 1.0.0 * @category mapping */ export declare const mapEffect: { (f: (z: Z) => Effect.Effect): (self: Sink) => Sink; (self: Sink, f: (z: Z) => Effect.Effect): Sink; }; /** * Transforms the errors emitted by this sink using `f`. * * @since 1.0.0 * @category mapping */ export declare const mapError: { (f: (error: E) => E2): (self: Sink) => Sink; (self: Sink, f: (error: E) => E2): Sink; }; /** * Transforms the leftovers emitted by this sink using `f`. * * @since 1.0.0 * @category mapping */ export declare const mapLeftover: { (f: (leftover: L) => L2): (self: Sink) => Sink; (self: Sink, f: (leftover: L) => L2): Sink; }; /** * Creates a sink which transforms it's inputs into a string. * * @since 1.0.0 * @category constructors */ export declare const mkString: Sink; /** * Creates a sink which never terminates. * * @since 1.0.0 * @category constructors */ export declare const never: Sink; /** * Switch to another sink in case of failure * * @since 1.0.0 * @category error handling */ export declare const orElse: { (that: LazyArg>): (self: Sink) => Sink; (self: Sink, that: LazyArg>): Sink; }; /** * Provides the sink with its required context, which eliminates its * dependency on `R`. * * @since 1.0.0 * @category context */ export declare const provideContext: { (context: Context.Context): (self: Sink) => Sink; (self: Sink, context: Context.Context): Sink; }; /** * Runs both sinks in parallel on the input, , returning the result or the * error from the one that finishes first. * * @since 1.0.0 * @category utils */ export declare const race: { (that: Sink): (self: Sink) => Sink; (self: Sink, that: Sink): Sink; }; /** * Runs both sinks in parallel on the input, returning the result or the error * from the one that finishes first. * * @since 1.0.0 * @category utils */ export declare const raceBoth: { (that: Sink, options?: { readonly capacity?: number; }): (self: Sink) => Sink>; (self: Sink, that: Sink, options?: { readonly capacity?: number; }): Sink>; }; /** * Runs both sinks in parallel on the input, using the specified merge * function as soon as one result or the other has been computed. * * @since 1.0.0 * @category utils */ export declare const raceWith: { (options: { readonly other: Sink; readonly onSelfDone: (exit: Exit.Exit) => MergeDecision.MergeDecision; readonly onOtherDone: (exit: Exit.Exit) => MergeDecision.MergeDecision; readonly capacity?: number; }): (self: Sink) => Sink; (self: Sink, options: { readonly other: Sink; readonly onSelfDone: (exit: Exit.Exit) => MergeDecision.MergeDecision; readonly onOtherDone: (exit: Exit.Exit) => MergeDecision.MergeDecision; readonly capacity?: number; }): Sink; }; /** * @since 1.0.0 * @category error handling */ export declare const refineOrDie: { (pf: (error: E) => Option.Option): (self: Sink) => Sink; (self: Sink, pf: (error: E) => Option.Option): Sink; }; /** * @since 1.0.0 * @category error handling */ export declare const refineOrDieWith: (pf: (error: E) => Option.Option, f: (error: E) => unknown) => (self: Sink) => Sink; /** * A sink that returns whether an element satisfies the specified predicate. * * @since 1.0.0 * @category constructors */ export declare const some: (predicate: Predicate) => Sink; /** * Splits the sink on the specified predicate, returning a new sink that * consumes elements until an element after the first satisfies the specified * predicate. * * @since 1.0.0 * @category utils */ export declare const splitWhere: { (f: Predicate): (self: Sink) => Sink; (self: Sink, f: Predicate): Sink; }; /** * A sink that immediately ends with the specified value. * * @since 1.0.0 * @category constructors */ export declare const succeed: (z: Z) => Sink; /** * A sink that sums incoming numeric values. * * @since 1.0.0 * @category constructors */ export declare const sum: Sink; /** * Summarize a sink by running an effect when the sink starts and again when * it completes. * * @since 1.0.0 * @category utils */ export declare const summarized: { (summary: Effect.Effect, f: (start: Z2, end: Z2) => Z3): (self: Sink) => Sink; (self: Sink, summary: Effect.Effect, f: (start: Z2, end: Z2) => Z3): Sink; }; /** * Returns a lazily constructed sink that may require effects for its * creation. * * @since 1.0.0 * @category constructors */ export declare const suspend: (evaluate: LazyArg>) => Sink; /** * A sink that immediately ends with the specified lazy value. * * @since 1.0.0 * @category constructors */ export declare const sync: (evaluate: LazyArg) => Sink; /** * A sink that takes the specified number of values. * * @since 1.0.0 * @category constructors */ export declare const take: (n: number) => Sink>; /** * @since 1.0.0 * @category constructors */ export declare const timed: Sink; /** * Creates a sink produced from an effect. * * @since 1.0.0 * @category constructors */ export declare const unwrap: (effect: Effect.Effect>) => Sink; /** * Creates a sink produced from a scoped effect. * * @since 1.0.0 * @category constructors */ export declare const unwrapScoped: (effect: Effect.Effect>) => Sink, E, In, L, Z>; /** * Returns the sink that executes this one and times its execution. * * @since 1.0.0 * @category utils */ export declare const withDuration: (self: Sink) => Sink; /** * Feeds inputs to this sink until it yields a result, then switches over to * the provided sink until it yields a result, finally combining the two * results into a tuple. * * @since 1.0.0 * @category zipping */ export declare const zip: { (that: Sink, options?: { readonly concurrent?: boolean; }): (self: Sink) => Sink; (self: Sink, that: Sink, options?: { readonly concurrent?: boolean; }): Sink; }; /** * Like `Sink.zip` but keeps only the result from this sink. * * @since 1.0.0 * @category zipping */ export declare const zipLeft: { (that: Sink, options?: { readonly concurrent?: boolean; }): (self: Sink) => Sink; (self: Sink, that: Sink, options?: { readonly concurrent?: boolean; }): Sink; }; /** * Like `Sink.zip` but keeps only the result from `that` sink. * * @since 1.0.0 * @category zipping */ export declare const zipRight: { (that: Sink, options?: { readonly concurrent?: boolean; }): (self: Sink) => Sink; (self: Sink, that: Sink, options?: { readonly concurrent?: boolean; }): Sink; }; /** * Feeds inputs to this sink until it yields a result, then switches over to * the provided sink until it yields a result, finally combining the two * results with `f`. * * @since 1.0.0 * @category zipping */ export declare const zipWith: { (that: Sink, f: (z: Z, z1: Z2) => Z3, options?: { readonly concurrent?: boolean; }): (self: Sink) => Sink; (self: Sink, that: Sink, f: (z: Z, z1: Z2) => Z3, options?: { readonly concurrent?: boolean; }): Sink; }; //# sourceMappingURL=Sink.d.ts.map