/** * The moral equivalent of `if (p) exp` when `p` has side-effects. * * @tsplus static effect/core/stm/STM.Ops whenSTM */ export function whenSTM( predicate: STM, effect: STM ): STM> { return predicate.flatMap((b) => (b ? effect.asSome : STM.none)) }