/** * Creates a stream by peeling off the "layers" of a value of type `S`. * * @tsplus static effect/core/stream/Stream.Ops unfold */ export function unfold(s: S, f: (s: S) => Maybe): Stream { return Stream.unfoldChunk(s, (s) => f(s).map(([a, s]) => [Chunk.single(a), s])) }