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

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