<div dir="ltr"><div>I have a question about the streaming package.</div><div><br></div>Let's say I have str :: Stream (Of String) IO ()<div>I want to putStrLn each element and then print the length of str, so I could do this:</div><div><br></div><div>import Streaming</div><div>import qualified Streaming.Prelude as SP</div><div><br></div><div>doit :: Stream (Of String) IO () -> IO ()</div><div>doit str =</div><div>  do</div><div>    SP.mapM_ putStrLn str</div><div>    SP.length_ str >>= print</div><div><br>However, will this result in doing 2 passes over str so that the memory requirement is not constant? If so, is there a simple way to combine the two actions so that only pass is needed? I could probably use a counter in a StateT but that's not really simple. More generally, are there techniques for combining folds like how one would with the foldl package?</div><div><br></div></div>