import * as Exit from "../../Exit.ts" import * as Option from "../../Option.ts" import { args } from "../core.ts" /** @internal */ export const missing = Symbol() /** @internal */ export { args } /** @internal */ export type Success = Exit.Success & { readonly [args]: A } /** @internal */ export const succeed = Exit.succeed as (value: A) => Success /** @internal */ export const missingExit = succeed(missing) // Shared success for a present input returned unchanged. It must be resolved // before crossing an asynchronous or transformation boundary. /** @internal */ export const sameExit: Success = succeed(missing) /** @internal */ export const toOption = (value: A): Option.Option => value === missing ? Option.none() : Option.some(value as A) /** @internal */ export const fromOptionExit = (option: Option.Option): Success => option._tag === "None" ? missingExit : succeed(option.value)