/** * The moral equivalent of `if (p) exp`. * * @tsplus static effect/core/stm/STM.Ops when */ export function when( predicate: LazyArg, effect: STM ): STM> { return STM.suspend( predicate() ? effect.map(Maybe.some) : STM.succeed(Maybe.none) ) }