import * as tsplus_module_1 from "@tsplus/stdlib/collections/Chunk/single";
import * as tsplus_module_2 from "@tsplus/stdlib/data/Tuple/make";
import * as tsplus_module_3 from "@tsplus/stdlib/data/Maybe/map";
import * as tsplus_module_4 from "@effect/core/stream/Stream/operations/unfoldChunk";
/**
 * Creates a stream by peeling off the "layers" of a value of type `S`.
 *
 * @tsplus static ets/Stream/Ops unfold
 */

export function unfold(s, f, __tsplusTrace) {
  return tsplus_module_4.unfoldChunk(s, s => tsplus_module_3.map_(f(s), ({
    tuple: [a, s]
  }) => tsplus_module_2.make(tsplus_module_1.single(a), s)), __tsplusTrace);
}
//# sourceMappingURL=unfold.mjs.map