import * as tsplus_module_1 from "@effect/core/stm/STM/operations/fail";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Maybe/getOrElse";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/flatMap";
/**
 * Fail with `e` if the supplied partial function does not match, otherwise
 * continue with the returned value.
 *
 * @tsplus fluent ets/STM continueOrFailSTM
 */

export function continueOrFailSTM_(self, e, pf) {
  return tsplus_module_3.flatMap_(self, a => tsplus_module_2.getOrElse_(pf(a), () => tsplus_module_1.fail(e)));
}
/**
 * Fail with `e` if the supplied partial function does not match, otherwise
 * continue with the returned value.
 *
 * @tsplus static ets/STM/Aspects continueOrFailSTM
 */

export const continueOrFailSTM = (e, pf) => self => continueOrFailSTM_(self, e, pf);
//# sourceMappingURL=continueOrFailSTM.mjs.map