// ets_tracing: off import type * as T from "../../../../Effect/index.js" import type * as E from "../../../../Either/index.js" import type * as Ex from "../../../../Exit/index.js" import type * as F from "../../../../Fiber/index.js" export const BothRunningTypeId = Symbol() export class BothRunning<_Env, Err, Err1, _Err2, Elem, Done, Done1, _Done2> { readonly _typeId: typeof BothRunningTypeId = BothRunningTypeId constructor( readonly left: F.Fiber>, readonly right: F.Fiber> ) {} } export const LeftDoneTypeId = Symbol() export class LeftDone { readonly _typeId: typeof LeftDoneTypeId = LeftDoneTypeId constructor(readonly f: (ex: Ex.Exit) => T.Effect) {} } export const RightDoneTypeId = Symbol() export class RightDone { readonly _typeId: typeof RightDoneTypeId = RightDoneTypeId constructor(readonly f: (ex: Ex.Exit) => T.Effect) {} } export type MergeState = | BothRunning | LeftDone | RightDone export const _R = "_R" as const export const _E0 = "_E0" as const export const _Z0 = "_Z0" as const export const _E = "_E" as const export const _Z = "_Z" as const export const MergeDecisionTypeId = Symbol() export abstract class MergeDecision { readonly _mergeDecisionTypeId: typeof MergeDecisionTypeId = MergeDecisionTypeId; readonly [_R]: (_: R) => void; readonly [_E0]: (_: E0) => void; readonly [_Z0]: (_: Z0) => void; readonly [_E]: () => E; readonly [_Z]: () => Z } export function concrete( decision: MergeDecision ): asserts decision is Done | Await { // } export const DoneTypeId = Symbol() export class Done extends MergeDecision { readonly _typeId: typeof DoneTypeId = DoneTypeId constructor(readonly io: T.Effect) { super() } } export const AwaitTypeId = Symbol() export class Await extends MergeDecision { readonly _typeId: typeof AwaitTypeId = AwaitTypeId constructor(readonly f: (ex: Ex.Exit) => T.Effect) { super() } } export function done( io: T.Effect ): MergeDecision { return new Done(io) } export function await_( f: (ex: Ex.Exit) => T.Effect ): MergeDecision { return new Await(f) } export function awaitConst( io: T.Effect ): MergeDecision { return new Await((_) => io) }