/** * @since 2.0.0 */ import type * as Effect from "./Effect.js" import type * as Either from "./Either.js" import type * as Exit from "./Exit.js" import type * as Fiber from "./Fiber.js" import * as internal from "./internal/channel/mergeState.js" /** * @since 2.0.0 * @category symbols */ export const MergeStateTypeId: unique symbol = internal.MergeStateTypeId /** * @since 2.0.0 * @category symbols */ export type MergeStateTypeId = typeof MergeStateTypeId /** * @since 2.0.0 * @category models */ export type MergeState = | BothRunning | LeftDone | RightDone /** * @since 2.0.0 */ export declare namespace MergeState { /** * @since 2.0.0 * @category models */ export interface Proto { readonly [MergeStateTypeId]: MergeStateTypeId } } /** * @since 2.0.0 * @category models */ export interface BothRunning<_Env, out Err, out Err1, _Err2, out Elem, out Done, out Done1, _Done2> extends MergeState.Proto { readonly _tag: "BothRunning" readonly left: Fiber.Fiber, Err> readonly right: Fiber.Fiber, Err1> } /** * @since 2.0.0 * @category models */ export interface LeftDone extends MergeState.Proto { readonly _tag: "LeftDone" f(exit: Exit.Exit): Effect.Effect } /** * @since 2.0.0 * @category models */ export interface RightDone extends MergeState.Proto { readonly _tag: "RightDone" f(exit: Exit.Exit): Effect.Effect } /** * @since 2.0.0 * @category constructors */ export const BothRunning: ( left: Fiber.Fiber, Err>, right: Fiber.Fiber, Err1> ) => MergeState = internal.BothRunning /** * @since 2.0.0 * @category constructors */ export const LeftDone: ( f: (exit: Exit.Exit) => Effect.Effect ) => MergeState = internal.LeftDone /** * @since 2.0.0 * @category constructors */ export const RightDone: ( f: (exit: Exit.Exit) => Effect.Effect ) => MergeState = internal.RightDone /** * Returns `true` if the specified value is a `MergeState`, `false` otherwise. * * @since 2.0.0 * @category refinements */ export const isMergeState: ( u: unknown ) => u is MergeState = internal.isMergeState /** * Returns `true` if the specified `MergeState` is a `BothRunning`, `false` * otherwise. * * @since 2.0.0 * @category refinements */ export const isBothRunning: ( self: MergeState ) => self is BothRunning = internal.isBothRunning /** * Returns `true` if the specified `MergeState` is a `LeftDone`, `false` * otherwise. * * @since 2.0.0 * @category refinements */ export const isLeftDone: ( self: MergeState ) => self is LeftDone = internal.isLeftDone /** * Returns `true` if the specified `MergeState` is a `RightDone`, `false` * otherwise. * * @since 2.0.0 * @category refinements */ export const isRightDone: ( self: MergeState ) => self is RightDone = internal.isRightDone /** * @since 2.0.0 * @category folding */ export const match: { /** * @since 2.0.0 * @category folding */ ( options: { readonly onBothRunning: ( left: Fiber.Fiber, Err>, right: Fiber.Fiber, Err1> ) => Z readonly onLeftDone: (f: (exit: Exit.Exit) => Effect.Effect) => Z readonly onRightDone: (f: (exit: Exit.Exit) => Effect.Effect) => Z } ): (self: MergeState) => Z /** * @since 2.0.0 * @category folding */ ( self: MergeState, options: { readonly onBothRunning: ( left: Fiber.Fiber, Err>, right: Fiber.Fiber, Err1> ) => Z readonly onLeftDone: (f: (exit: Exit.Exit) => Effect.Effect) => Z readonly onRightDone: (f: (exit: Exit.Exit) => Effect.Effect) => Z } ): Z } = internal.match