import * as tsplus_module_1 from "@tsplus/stdlib/collections/Chunk/empty";
import * as tsplus_module_2 from "@effect/core/stm/STM/operations/succeed";
import * as tsplus_module_3 from "@effect/core/stm/STM/operations/suspend";
import * as tsplus_module_4 from "@tsplus/stdlib/collections/Chunk/append";
import * as tsplus_module_5 from "@effect/core/stm/STM/operations/zipWith";
import * as tsplus_module_6 from "@tsplus/stdlib/collections/Collection/functions";
/**
 * Filters the collection using the specified effectual predicate.
 *
 * @tsplus static ets/STM/Ops filter
 */

export function filter(as, f) {
  return tsplus_module_3.suspend(() => tsplus_module_6.reduce_(as(), tsplus_module_2.succeed(() => tsplus_module_1.empty()), (io, a) => tsplus_module_5.zipWith_(io, () => tsplus_module_3.suspend(() => f(a)), (acc, b) => b ? tsplus_module_4.append_(acc, a) : acc)));
}
//# sourceMappingURL=filter.mjs.map