import * as tsplus_module_1 from "@effect/core/stm/STM/operations/succeedNone";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/asSome";
import * as tsplus_module_3 from "@tsplus/stdlib/data/Maybe/map";
import * as tsplus_module_4 from "@tsplus/stdlib/data/Maybe/getOrElse";
import * as tsplus_module_5 from "@effect/core/stm/STM/operations/suspend";
/**
 * Runs an effect when the supplied partial function matches for the given
 * value, otherwise does nothing.
 *
 * @tsplus static ets/STM/Ops whenCase
 */

export function whenCase(a, pf, __tsplusTrace) {
  return tsplus_module_5.suspend(() => tsplus_module_4.getOrElse_(tsplus_module_3.map_(pf(a()), effect => tsplus_module_2.asSome(effect)), () => tsplus_module_1.succeedNone));
}
//# sourceMappingURL=whenCase.mjs.map