Will Stream support having effectful step functions, or is that the domain of a separate future design for something else, like generators?
To create a Stream, I understand I have to go via an Iter, and that effects can only be executed via map!ping the intermediate outputs of the Iter. This means though that the stopping condition of the Stream must be determined by the pure step function supplied in custom, but for reading a file it is determined by the effect returning EOF. I can kind of guess why this limitation exists (if I've read this right), but I'm curious if it's likely to stick around.
Outside of adding effects like for_each_line! to the platform, in roc-land I guess I can just use for loops, or something wrapping them that maps and stores in a list? It would be nice to have access to the combinators though.
oh step should be effectful
if it's not, probably an oversight from its implementation having been copied from Iter :laughing:
Ah, it seems it is step! internally, but because Stream is opaque you can only go via the Iter constructors, e.g., as described in the stream docs
Produced from an Iter via [Iter.map!] and driven by [Stream.collect!].
oh yeah we should have Stream.custom similar to Iter.custom
Last updated: Aug 12 2026 at 12:35 UTC