Meta
Archives
- September 2016 (1)
- May 2016 (1)
- January 2016 (2)
- April 2015 (1)
- August 2014 (1)
- May 2013 (1)
- November 2012 (2)
- August 2012 (1)
- July 2012 (16)
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
Pipes to Conduits part 0: Combining Functors
A Functor in Haskell is a type of kind f :: * -> *, which supports the operation fmap :: (a -> b) -> f a -> f b. Many "container" types are Functors, including the List type. But we’re … Continue reading
Posted in Uncategorized
Leave a comment
Breaking from a Loop with ContT
Sort of in response to Breaking from a Loop. Sometimes I wish Haskell culture embraced ContT more. > import Control.Monad.Cont > import Control.Monad.State > import Control.Monad.IO.Class loopForever Suppose I wanted to break out of loops using a user-defined label for … Continue reading
Posted in Uncategorized
Leave a comment
The Long and Epic Journey of LambdaCase
On December 16, 2005, Haskell Prime trac ticket #41 was born, with the humble title add LambdaCase. The description field contained a pointer to the LambdaCase wiki article, whose contents are also quite humble: case statements as first order a … Continue reading
Posted in Uncategorized
4 Comments