Re: [Haskell-cafe] operations on lists with continuations

2011-03-08 Thread Evan Laforge
On Thu, Mar 3, 2011 at 12:33 AM, Mark Lentczner mark.lentcz...@gmail.com wrote: 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/Plumbing.hs

Re: [Haskell-cafe] operations on lists with continuations

2011-03-08 Thread Evan Laforge
On Wed, Mar 2, 2011 at 12:00 AM, Stephen Tetley stephen.tet...@gmail.com wrote: Maybe you've invented the ApoPrelude? If I were doing it I'd probably code them in terms of an apomorphism - unfoldr with flush. Unlike regular unfoldr which discards the final state, an apomorphism uses the final

Re: [Haskell-cafe] operations on lists with continuations

2011-03-03 Thread 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/Plumbing.hs With it, I think you can construct the kinds of pipelines you describe with the

Re: [Haskell-cafe] operations on lists with continuations

2011-03-02 Thread Stephen Tetley
Maybe you've invented the ApoPrelude? If I were doing it I'd probably code them in terms of an apomorphism - unfoldr with flush. Unlike regular unfoldr which discards the final state, an apomorphism uses the final state to produce the tail of the output list. See Jeremy Gibbons paper Streaming

[Haskell-cafe] operations on lists with continuations

2011-03-01 Thread Evan Laforge
I have a few functions for operating on lists that take continuations: -- | Like takeWhile but with a continuation, so you can chain takes without -- copying. takeWhileThen :: (a - Bool) - ([a] - [a]) - [a] - [a] takeWhileThen _ _ [] = [] takeWhileThen f cont (x:xs) | f x = x : takeWhileThen