import * as tsplus_module_1 from "@effect/core/stm/STM/operations/fail";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/catchAll";
export const catch_ = catch_1;
export const _catch = _catch_1;
/**
 * Recovers from specified error.
 *
 * @tsplus fluent ets/STM catch
 */

function catch_1(self, tag, k, f) {
  return tsplus_module_2.catchAll_(self, e => {
    if (tag in e && e[tag] === k) {
      return f(e);
    }

    return tsplus_module_1.fail(() => e);
  });
}
/**
 * Recovers from specified error.
 *
 * @tsplus static ets/STM/Aspects catch
 */


function _catch_1(tag, k, f) {
  return self => catch_1(self, tag, k, f);
}

export { _catch_1 as catch };
//# sourceMappingURL=catch.mjs.map