/** * @since 1.0.0 */ import type * as Chunk from "@effect/data/Chunk"; import type * as Option from "@effect/data/Option"; import type { Pipeable } from "@effect/data/Pipeable"; import type * as Cause from "@effect/io/Cause"; import type * as Effect from "@effect/io/Effect"; import type * as Exit from "@effect/io/Exit"; /** * @since 1.0.0 * @category symbols */ export declare const TakeTypeId: unique symbol; /** * @since 1.0.0 * @category symbols */ export type TakeTypeId = typeof TakeTypeId; /** * A `Take` represents a single `take` from a queue modeling a stream of * values. A `Take` may be a failure cause `Cause`, a chunk value `Chunk`, * or an end-of-stream marker. * * @since 1.0.0 * @category models */ export interface Take extends Take.Variance, Pipeable { } /** * @since 1.0.0 */ export declare namespace Take { /** * @since 1.0.0 * @category models */ interface Variance { readonly [TakeTypeId]: { readonly _E: (_: never) => E; readonly _A: (_: never) => A; }; } } /** * Creates a `Take` with the specified chunk. * * @since 1.0.0 * @category constructors */ export declare const chunk: (chunk: Chunk.Chunk) => Take; /** * Creates a failing `Take` with the specified defect. * * @since 1.0.0 * @category constructors */ export declare const die: (defect: unknown) => Take; /** * Creates a failing `Take` with the specified error message. * * @since 1.0.0 * @category constructors */ export declare const dieMessage: (message: string) => Take; /** * Transforms a `Take` to an `Effect`. * * @since 1.0.0 * @category destructors */ export declare const done: (self: Take) => Effect.Effect, Chunk.Chunk>; /** * Represents the end-of-stream marker. * * @since 1.0.0 * @category constructors */ export declare const end: Take; /** * Creates a failing `Take` with the specified error. * * @since 1.0.0 * @category constructors */ export declare const fail: (error: E) => Take; /** * Creates a failing `Take` with the specified cause. * * @since 1.0.0 * @category constructors */ export declare const failCause: (cause: Cause.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.failCause`. Creates a single value chunk. * * @since 1.0.0 * @category constructors */ export declare const fromEffect: (effect: Effect.Effect) => Effect.Effect>; /** * Creates a `Take` from an `Exit`. * * @since 1.0.0 * @category constructors */ export declare const fromExit: (exit: Exit.Exit) => Take; /** * Creates effect from `Effect, Chunk>` that does not fail, but * succeeds with the `Take`. Errors from stream when pulling are converted * to `Take.failCause`, and the end-of-stream is converted to `Take.end`. * * @since 1.0.0 * @category constructors */ export declare const fromPull: (pull: Effect.Effect, Chunk.Chunk>) => Effect.Effect>; /** * Checks if this `take` is done (`Take.end`). * * @since 1.0.0 * @category getters */ export declare const isDone: (self: Take) => boolean; /** * Checks if this `take` is a failure. * * @since 1.0.0 * @category getters */ export declare const isFailure: (self: Take) => boolean; /** * Checks if this `take` is a success. * * @since 1.0.0 * @category getters */ export declare const isSuccess: (self: Take) => boolean; /** * Constructs a `Take`. * * @since 1.0.0 * @category constructors */ export declare const make: (exit: Exit.Exit, Chunk.Chunk>) => Take; /** * Transforms `Take` to `Take` by applying function `f`. * * @since 1.0.0 * @category mapping */ export declare const map: { (f: (a: A) => B): (self: Take) => Take; (self: Take, f: (a: A) => B): Take; }; /** * Folds over the failure cause, success value and end-of-stream marker to * yield a value. * * @since 1.0.0 * @category destructors */ export declare const match: { (options: { readonly onEnd: () => Z; readonly onFailure: (cause: Cause.Cause) => Z2; readonly onSuccess: (chunk: Chunk.Chunk) => Z3; }): (self: Take) => Z | Z2 | Z3; (self: Take, options: { readonly onEnd: () => Z; readonly onFailure: (cause: Cause.Cause) => Z2; readonly onSuccess: (chunk: Chunk.Chunk) => Z3; }): Z | Z2 | Z3; }; /** * Effectful version of `Take.fold`. * * Folds over the failure cause, success value and end-of-stream marker to * yield an effect. * * @since 1.0.0 * @category destructors */ export declare const matchEffect: { (options: { readonly onEnd: () => Effect.Effect; readonly onFailure: (cause: Cause.Cause) => Effect.Effect; readonly onSuccess: (chunk: Chunk.Chunk) => Effect.Effect; }): (self: Take) => Effect.Effect; (self: Take, options: { readonly onEnd: () => Effect.Effect; readonly onFailure: (cause: Cause.Cause) => Effect.Effect; readonly onSuccess: (chunk: Chunk.Chunk) => Effect.Effect; }): Effect.Effect; }; /** * Creates a `Take` with a single value chunk. * * @since 1.0.0 * @category constructors */ export declare const of: (value: A) => Take; /** * Returns an effect that effectfully "peeks" at the success of this take. * * @since 1.0.0 * @category sequencing */ export declare const tap: { (f: (chunk: Chunk.Chunk) => Effect.Effect): (self: Take) => Effect.Effect; (self: Take, f: (chunk: Chunk.Chunk) => Effect.Effect): Effect.Effect; }; //# sourceMappingURL=Take.d.ts.map