Build a
Stream by unfolding steps starting from a seed. In
particular note that
S.unfoldr S.next = id.
The seed can of course be anything, but this is one natural way to
consume a
pipes Producer. Consider:
>>> S.stdoutLn $ S.take 2 $ S.unfoldr Pipes.next Pipes.stdinLn
hello<Enter>
hello
goodbye<Enter>
goodbye
>>> S.stdoutLn $ S.unfoldr Pipes.next (Pipes.stdinLn >-> Pipes.take 2)
hello<Enter>
hello
goodbye<Enter>
goodbye
>>> S.effects $ S.unfoldr Pipes.next (Pipes.stdinLn >-> Pipes.take 2 >-> Pipes.stdoutLn)
hello<Enter>
hello
goodbye<Enter>
goodbye
Pipes.unfoldr S.next similarly unfolds a
Pipes.Producer from a stream.