To summarize:
Stream transformations are built using pulls.
All streams can be converted to pulls, and some pulls can be converted to streams.
Pulls can output elements and return a result.
Pulls are monads — they can be composed using
flatMap
.
You’re now well equipped to be creative with your own custom pulls. If you need more inspiration, take a look at the following posts.
Gavin Bisesi’s excellent gist explores a more advanced usage of pulls with effects as well as some gotchas of working with effect evaluation.
Have a look at the fs2 codebase to see how its own pipes and are written.
Read Fabio Labella’s explanation on Gitter to learn more about the reasoning behind pulls.
Credits
Many thanks to Fabio Labella, Gavin Bisesi, Michael Pilquist and Adam Rosien for giving this a reassuring read.