/** * Runs an effect when the supplied partial function matches for the given * value, otherwise does nothing. * * @tsplus static effect/core/stm/STM.Ops whenCase */ export function whenCase( a: LazyArg, pf: (a: A) => Maybe> ): STM> { return STM.sync(a).flatMap((a) => pf(a).map((stm) => stm.asSome).getOrElse(STM.none)) }