// ets_tracing: off
import * as A from "../../Collections/Immutable/Chunk";
import { pipe } from "../../Function";
import * as T from "../_internal/effect";
import * as M from "../_internal/managed";
import * as Ref from "../_internal/ref";
import { Stream } from "./definitions";
/**
 * The infinite stream of iterative function application: a, f(a), f(f(a)), f(f(f(a))), ...
 */

export function iterate(a, f) {
  return new Stream(M.map_(T.toManaged(Ref.makeRef(a)), x => T.map_(Ref.getAndUpdate_(x, f), A.single)));
}
//# sourceMappingURL=iterate.js.map