/** * Applies the function `f` to each element of the `Collection` and runs * produced effects sequentially. * * Equivalent to `unit(forEach(as, f))`, but without the cost of building * the list of results. * * @tsplus static effect/core/stm/STM.Ops forEachDiscard */ export function forEachDiscard( as: Collection, f: (a: A) => STM ): STM { return STM.suspend(loop(as[Symbol.iterator](), f)) } function loop( iterator: Iterator, f: (a: A) => STM ): STM { const next = iterator.next() return next.done ? STM.unit : f(next.value) > loop(iterator, f) }