// ets_tracing: off import * as T from "../Effect/index.js" import * as Ex from "../Exit/index.js" import type * as M from "../Managed/index.js" export class Attempted { readonly [T._E]: () => E; readonly [T._A]: () => A constructor(readonly result: Ex.Exit, readonly finalizer: T.UIO) {} } export function isFailure(self: Attempted): boolean { return self.result._tag === "Failure" } export function forEachUnit_( self: Attempted, f: (a: A) => T.Effect ): T.Effect { return Ex.foldM_( self.result, (_) => T.unit, (a) => f(a) ) } export function forEachUnit(f: (a: A) => T.Effect) { return (self: Attempted) => forEachUnit_(self, f) } export function toManaged(self: Attempted): M.IO { return T.toManaged(T.done(self.result)) }