import "../../../../Operator/index.js"; import type * as Cause from "../../../../Cause/index.js"; import type * as T from "../../../../Effect/index.js"; import type * as Exit from "../../../../Exit/index.js"; import type { AsyncInputProducer } from "./producer.js"; import { _Env, _InDone, _InElem, _InErr, _OutDone, _OutDone2, _OutElem, _OutErr, _OutErr2 } from "./symbols.js"; /** * A `Channel` is a nexus of I/O operations, which supports both reading and writing. * A channel may read values of type `InElem` and write values of type `OutElem`. * When the channel finishes, it yields a value of type `OutDone`. A channel may fail with * a value of type `OutErr`. * * Channels are the foundation of Streams: both streams and sinks are built on channels. * Most users shouldn't have to use channels directly, as streams and sinks are much more convenient * and cover all common use cases. However, when adding new stream and sink operators, or doing * something highly specialized, it may be useful to use channels directly. * * Channels compose in a variety of ways: * * - Piping. One channel can be piped to another channel, assuming the input type of the second * is the same as the output type of the first. * - Sequencing. The terminal value of one channel can be used to create another channel, and * both the first channel and the function that makes the second channel can be composed into a * channel. * - Concating. The output of one channel can be used to create other channels, which are all * concatenated together. The first channel and the function that makes the other channels can * be composed into a channel. */ export declare abstract class Channel { readonly [_Env]: (_: Env) => void; readonly [_InErr]: (_: InErr) => void; readonly [_InElem]: (_: InElem) => void; readonly [_InDone]: (_: InDone) => void; readonly [_OutErr]: () => OutErr; readonly [_OutElem]: () => OutElem; readonly [_OutDone]: () => OutDone; readonly [">>>"]: (that: Channel) => Channel; } export declare abstract class Continuation { readonly [_Env]: (_: Env) => void; readonly [_InErr]: (_: InErr) => void; readonly [_InElem]: (_: InElem) => void; readonly [_InDone]: (_: InDone) => void; readonly [_OutErr]: (_: OutErr) => OutErr; readonly [_OutDone]: (_: OutDone) => OutDone; readonly [_OutErr2]: () => OutErr2; readonly [_OutElem]: () => OutElem; readonly [_OutDone2]: () => OutDone2; } /** * @ets_optimize remove */ export declare function concreteContinuation(_: Continuation): asserts _ is ContinuationK | ContinuationFinalizer; export declare const ContinuationKTypeId: unique symbol; export declare type ContinuationKTypeId = typeof ContinuationKTypeId; export declare class ContinuationK extends Continuation { readonly onSuccess: (o: OutDone) => Channel; readonly onHalt: (c: Cause.Cause) => Channel; readonly _typeId: ContinuationKTypeId; constructor(onSuccess: (o: OutDone) => Channel, onHalt: (c: Cause.Cause) => Channel); onExit(exit: Exit.Exit): Channel; } export declare const ContinuationFinalizerTypeId: unique symbol; export declare type ContinuationFinalizerTypeId = typeof ContinuationFinalizerTypeId; export declare class ContinuationFinalizer extends Continuation { readonly finalizer: (e: Exit.Exit) => T.RIO; readonly _typeId: ContinuationFinalizerTypeId; constructor(finalizer: (e: Exit.Exit) => T.RIO); } /** * @ets_optimize remove */ export declare function concrete(_: Channel): asserts _ is PipeTo | Read | Done | Halt | Effect | Emit | ConcatAll | Bridge | Fold | Provide | BracketOut | Ensuring | EffectTotal | EffectSuspendTotal; export declare const PipeToTypeId: unique symbol; export declare type PipeToTypeId = typeof PipeToTypeId; export declare class PipeTo extends Channel { readonly left: () => Channel; readonly right: () => Channel; readonly _typeId: PipeToTypeId; constructor(left: () => Channel, right: () => Channel); } export declare const ReadTypeId: unique symbol; export declare type ReadTypeId = typeof ReadTypeId; export declare class Read extends Channel { readonly more: (i: InElem) => Channel; readonly done: ContinuationK; readonly _typeId: ReadTypeId; constructor(more: (i: InElem) => Channel, done: ContinuationK); } export declare const DoneTypeId: unique symbol; export declare type DoneTypeId = typeof DoneTypeId; export declare class Done extends Channel { readonly terminal: () => OutDone; readonly _typeId: DoneTypeId; constructor(terminal: () => OutDone); } export declare const HaltTypeId: unique symbol; export declare type HaltTypeId = typeof HaltTypeId; export declare class Halt extends Channel { readonly error: () => Cause.Cause; readonly _typeId: HaltTypeId; constructor(error: () => Cause.Cause); } export declare const EffectTypeId: unique symbol; export declare type EffectTypeId = typeof EffectTypeId; export declare class Effect extends Channel { readonly effect: T.Effect; readonly _typeId: EffectTypeId; constructor(effect: T.Effect); } export declare const EmitTypeId: unique symbol; export declare type EmitTypeId = typeof EmitTypeId; export declare class Emit extends Channel { readonly out: () => OutElem; readonly _typeId: EmitTypeId; constructor(out: () => OutElem); } export declare const EnsuringTypeId: unique symbol; export declare type EnsuringTypeId = typeof EnsuringTypeId; export declare class Ensuring extends Channel { readonly channel: Channel; readonly finalizer: (e: Exit.Exit) => T.Effect; readonly _typeId: EnsuringTypeId; constructor(channel: Channel, finalizer: (e: Exit.Exit) => T.Effect); } export declare const ConcatAllTypeId: unique symbol; export declare type ConcatAllTypeId = typeof ConcatAllTypeId; export declare class ConcatAll extends Channel { readonly combineInners: (o: OutDone, o1: OutDone) => OutDone; readonly combineAll: (o: OutDone, o2: OutDone2) => OutDone3; readonly value: Channel; readonly k: (o: OutElem) => Channel; readonly _typeId: ConcatAllTypeId; constructor(combineInners: (o: OutDone, o1: OutDone) => OutDone, combineAll: (o: OutDone, o2: OutDone2) => OutDone3, value: Channel, k: (o: OutElem) => Channel); } export declare const FoldTypeId: unique symbol; export declare type FoldTypeId = typeof FoldTypeId; export declare class Fold extends Channel { readonly value: Channel; readonly k: ContinuationK; readonly _typeId: FoldTypeId; constructor(value: Channel, k: ContinuationK); } export declare const BridgeTypeId: unique symbol; export declare type BridgeTypeId = typeof BridgeTypeId; export declare class Bridge extends Channel { readonly input: AsyncInputProducer; readonly channel: Channel; readonly _typeId: BridgeTypeId; constructor(input: AsyncInputProducer, channel: Channel); } export declare const BracketOutTypeId: unique symbol; export declare type BracketOutTypeId = typeof BracketOutTypeId; export declare class BracketOut extends Channel { readonly acquire: T.Effect; readonly finalizer: (z: Z, e: Exit.Exit) => T.RIO; readonly _typeId: BracketOutTypeId; constructor(acquire: T.Effect, finalizer: (z: Z, e: Exit.Exit) => T.RIO); } export declare const ProvideTypeId: unique symbol; export declare type ProvideTypeId = typeof ProvideTypeId; export declare class Provide extends Channel { readonly env: Env; readonly channel: Channel; readonly _typeId: ProvideTypeId; constructor(env: Env, channel: Channel); } export declare const EffectTotalTypeId: unique symbol; export declare type EffectTotalTypeId = typeof EffectTotalTypeId; export declare class EffectTotal extends Channel { readonly effect: () => OutDone; readonly _typeId: EffectTotalTypeId; constructor(effect: () => OutDone); } export declare const EffectSuspendTotalTypeId: unique symbol; export declare type EffectSuspendTotalTypeId = typeof EffectSuspendTotalTypeId; export declare class EffectSuspendTotal extends Channel { readonly effect: () => Channel; readonly _typeId: EffectSuspendTotalTypeId; constructor(effect: () => Channel); } //# sourceMappingURL=primitives.d.ts.map