// ets_tracing: off import { range } from "../Collections/Immutable/Array/index.js" import type { Effect } from "./effect.js" import { collectAllUnit } from "./excl-forEach.js" /** * Replicates the given effect `n` times. * * @ets_data_first replicate_ */ export function replicate(n: number, __trace?: string) { return (self: Effect) => replicate_(self, n) } /** * Replicates the given effect `n` times. */ export function replicate_(self: Effect, n: number) { return range(0, n).map(() => self) } /** * Performs this effect the specified number of times, discarding the * results. */ export function replicateMUnit_( self: Effect, n: number ): Effect { return collectAllUnit(replicate_(self, n)) } /** * Performs this effect the specified number of times, discarding the * results. */ export function replicateMUnit(n: number) { return (self: Effect) => replicateMUnit_(self, n) }