import * as C from "../../../Cause/index.js"; import * as A from "../../../Collections/Immutable/Chunk/index.js"; import { _A, _E } from "../../../Effect/commons.js"; import * as T from "../../../Effect/index.js"; import * as Ex from "../../../Exit/index.js"; import * as O from "../../../Option/index.js"; import type { Pull } from "../Pull/index.js"; /** * A `Take` represents a single `take` from a queue modeling a stream of * values. A `Take` may be a failure cause `Cause`, an chunk value `A` * or an end-of-stream marker. */ export declare class Take { readonly exit: Ex.Exit, A.Chunk>; readonly [_E]: () => E; readonly [_A]: () => A; constructor(exit: Ex.Exit, A.Chunk>); } /** * Transforms `Take[E, A]` to `Effect[R, E, B]`. */ export declare function done(self: Take): T.IO, A.Chunk>; /** * Folds over the failure cause, success value and end-of-stream marker to * yield a value. */ export declare function fold_(self: Take, end: Z, error: (cause: C.Cause) => Z, value: (chunk: A.Chunk) => Z): Z; /** * Folds over the failure cause, success value and end-of-stream marker to * yield a value. * * @ets_data_first fold_ */ export declare function fold(end: Z, error: (cause: C.Cause) => Z, value: (chunk: A.Chunk) => Z): (self: Take) => Z; /** * Effectful version of `Take#fold`. * * Folds over the failure cause, success value and end-of-stream marker to * yield an effect. */ export declare function foldEffect_(self: Take, end: T.Effect, error: (cause: C.Cause) => T.Effect, value: (chunk: A.Chunk) => T.Effect): T.Effect; /** * Effectful version of `Take#fold`. * * Folds over the failure cause, success value and end-of-stream marker to * yield an effect. * * @ets_data_first foldEffect_ */ export declare function foldEffect(end: T.Effect, error: (cause: C.Cause) => T.Effect, value: (chunk: A.Chunk) => T.Effect): (self: Take) => T.Effect; /** * Checks if this `take` is done (`Take.end`). */ export declare function isDone(self: Take): boolean; /** * Checks if this `take` is a failure. */ export declare function isFailure(self: Take): boolean; /** * Checks if this `take` is a success. */ export declare function isSuccess(self: Take): boolean; /** * Transforms `Take` to `Take` by applying function `f`. */ export declare function map_(self: Take, f: (a: A) => B): Take; /** * Transforms `Take` to `Take` by applying function `f`. * * @ets_data_first map_ */ export declare function map(f: (a: A) => B): (self: Take) => Take; /** * Returns an effect that effectfully "peeks" at the success of this take. */ export declare function tap_(self: Take, f: (chunk: A.Chunk) => T.Effect): T.Effect; /** * Returns an effect that effectfully "peeks" at the success of this take. * * @ets_data_first tap_ */ export declare function tap(f: (chunk: A.Chunk) => T.Effect): (self: Take) => T.Effect; /** * Creates a `Take` with a singleton chunk. */ export declare function single(a: A): Take; /** * Creates a `Take[Nothing, A]` with the specified chunk. */ export declare function chunk(as: A.Chunk): Take; /** * Creates a failing `Take` with the specified failure. */ export declare function fail(e: E): Take; /** * Creates a failing `Take[E, Nothing]` with the specified cause. */ export declare function failCause(c: C.Cause): Take; /** * Creates an effect from `Effect` that does not fail, but succeeds with the `Take`. * Error from stream when pulling is converted to `Take.halt`. Creates a singleton chunk. */ export declare function fromEffect(effect: T.Effect): T.RIO>; /** * Creates effect from `Pull` that does not fail, but succeeds with the `Take`. * Error from stream when pulling is converted to `Take.halt`, end of stream to `Take.end`. */ export declare function fromPull(pull: Pull): T.RIO>; /** * Creates a failing `Take` with the specified cause. */ export declare function halt(c: C.Cause): Take; /** * Creates a failing `Take` with the specified throwable. */ export declare function die(e: E): Take; /** * Creates a failing `Take` with the specified error message. */ export declare function dieMessage(msg: string): Take; /** * Creates a `Take` from `Exit`. */ export declare function fromExit(exit: Ex.Exit): Take; /** * End-of-stream marker */ export declare const end: Take; //# sourceMappingURL=index.d.ts.map