
On Thu, Mar 3, 2011 at 12:33 AM, Mark Lentczner
To make up for my total misunderstanding of what you were asking before, I hereby offer you the Plumbing module, available here: https://bitbucket.org/mtnviewmark/haskell-playground/src/2d022b576c4e/Plumbi...
With it, I think you can construct the kinds of pipelines you describe with the composition aspects you desire:
Indeed, it looks like a more thorough version of what I'm doing. I'm guessing the breaking into pairs thing would be ultimately more composable, by which I mean lead to fewer special case functions.
:load Plumbing.hs [1 of 1] Compiling Plumbing ( Plumbing.hs, interpreted ) Ok, modules loaded: Plumbing. let filterUntil cond start end = (passUntil (>=start) =|= pfilter cond) =+= passWhile (
I would write the above as:
let filterUntilPlus1 cond start end = Then.filter cond (>=start) $ Then.takeWhile (
I think mine is less flexible but it interacts with the basic list functions more directly so it feels simpler to me. In a way it reminds me of STM, in that as long as you leave the last continuation on, it's still "open" and can be composed. But to get the actual result, you have to stick a non-continuation function on the end, at which point it no longer composes. I suppose that's the model for many many little DSLs though.