import type { Journal } from "@effect/core/stm/STM/definition/primitives" /** * @tsplus type effect/core/stm/STM/TryCommit */ export type TryCommit = Done | Suspend /** * @tsplus type effect/core/stm/STM/TryCommit.Ops */ export interface TryCommitOps {} export const TryCommit: TryCommitOps = {} export function unifyTryCommit>( self: X ): TryCommit< [X] extends [TryCommit] ? EX : never, [X] extends [TryCommit] ? AX : never > { return self } export class Done { readonly _tag = "Done" constructor(readonly exit: Exit) {} } export class Suspend { readonly _tag = "Suspend" constructor(readonly journal: Journal) {} } /** * @tsplus static effect/core/stm/STM/TryCommit.Ops done */ export function done(exit: Exit): TryCommit { return new Done(exit) } /** * @tsplus static effect/core/stm/STM/TryCommit.Ops suspend */ export function suspend(journal: Journal): TryCommit { return new Suspend(journal) }