
martin
writes:
A pipeline is a fixed set of functions, whereas with CPS I can say: if the value received is this, then continue this way, otherwise continue that way. With a simple pipeline I would have to put all these cases into the function which makes this decision and even pass the decision on to the next function in the pipeline so it know how we got there. Is this about right?
It's not only about right, I've implemented the concept here: http://hackage.haskell.org/package/simple-conduit This uses a short-circuiting continuation data type underneath: newtype Source m a = Source (forall r. Cont (r -> EitherT r m r) a) And then provides you with the capability to build Unix-style pipelines in order to keep memory use constant, and to ensure that all resources are freed when the pipeline finishes, or if it should short-circuit or fail. I have to look into why the Haddocks are failing to build, but they will build for you locally. John