/** * Count the values in the array matching a transactional predicate. * * @tsplus static effect/core/stm/TArray.Aspects countSTM * @tsplus pipeable effect/core/stm/TArray countSTM */ export function countSTM(f: (a: A) => STM) { return (self: TArray): STM => self.reduceSTM(0, (n, a) => f(a).map((result) => (result ? n + 1 : n))) }