Monthly Archives: July 2012

Pipes to Conduits part 7: Closing the input end early

Back in part 5, we added the ability to attach arbitrary finalizers to pipes. But when those finalizers actually ran was purely mechanical: when any given pipe finished, it would run all upstream finalizers, and then its own. This behavior … Continue reading

Posted in Uncategorized | Leave a comment

Pipes to Conduits part 6: Leftovers

One important use case of the Conduit library is parsing. In order to perform useful parsing, we need to be able to occasionally consume "too much" input, and then put the "leftovers" back into the input stream, as if they … Continue reading

Posted in Uncategorized | Leave a comment

Pipes to Conduits part 5: Finalizers

Last time we introduced abort recovery, allowing downstream pipes to recover from an abort. We were able to write the recover combinator, which could attach a recovery pipe to any other pipe. Today, we’ll look at a different aspect of … Continue reading

Posted in Uncategorized | Leave a comment

Pipes to Conduits part 4: Recovering from Abort

Last time, we introduced the abort primitive, which restored the power to write pipes a la Control.Pipe. However, the power for upstream pipes to force those downstream to abort is perhaps too much. This time, we’re going to give downstream … Continue reading

Posted in Uncategorized | Leave a comment

Pipes to Conduits part 3: Abort

Last time, we enhanced the await primitive, making it aware of when the upstream pipe returned a value. However, the change forced us to modify our style of programming. This is not necessarily a bad thing, but today, we’ll recover … Continue reading

Posted in Uncategorized | 1 Comment

Pipes to Conduits part 2: Upstream Results

Last time, we reimplemented Control.Pipe, with basic await and yield functionality. However, in order to compose two pipes, their result types had to be the same, and whenever any pipe in a pipeline reached its return, it would bring down … Continue reading

Posted in Uncategorized | Leave a comment

Pipes to Conduits part 1: Yield and Await

Last time we quickly reviewed several basic Functors in Haskell, and various ways to combine them. Today, we will put these functors to good use, and rewrite Control.Pipe (not that it needs rewriting; we’re just doing this for fun). > … Continue reading

Posted in Uncategorized | Leave a comment