Question

The pipes tutorial have mentioned this in their documentation:

If you sacrifice Effects you get Haskell's pure and lazy lists, which you can transform using composable functions in constant space, but without interleaving effects.

If you sacrifice Streaming you get mapM, forM and "ListT done wrong", which are composable and effectful, but do not return a single result until the whole list has first been processed and loaded into memory.

But doesn't Streaming imply interlaved effects ? When you are Streaming, you actually consume chunk by chunk. So, while consuming chunk by chunk isn't the effects interleaved ?

Was it helpful?

Solution

Streaming does indeed imply interleaved effects. The text you quote does not say otherwise.

To paraphrase the pipes documentation:

  • If you don't have effects, then you're just left with lazy data structures. They compose nicely but you can't do IO (except lazy IO, which we're trying to avoid).
  • If you do have effects but don't stream, then you can do IO but won't get a result until the end.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top