Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-29 Thread Dmitry Olshansky
Thank you! Working implementation is even more than I've expected. 2011/4/28 Felipe Almeida Lessa felipe.le...@gmail.com On Thu, Apr 28, 2011 at 1:10 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Thu, Apr 28, 2011 at 12:09 PM, Felipe Almeida Lessa felipe.le...@gmail.com

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-29 Thread John Lato
From: Felipe Almeida Lessa felipe.le...@gmail.com On Thu, Apr 28, 2011 at 1:10 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Thu, Apr 28, 2011 at 12:09 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: I foresee one problem: what is the leftover of 'manyToOne xs' if

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-29 Thread Felipe Almeida Lessa
On Fri, Apr 29, 2011 at 6:32 AM, John Lato jwl...@gmail.com wrote: If you do this, the user needs to take care to order the iteratees so that the last iteratee has small leftovers.  Consider: manyToOne [consumeALot, return ()] In this case, the entire stream consumed by the first iteratee

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-29 Thread John Lato
On Fri, Apr 29, 2011 at 12:20 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Fri, Apr 29, 2011 at 6:32 AM, John Lato jwl...@gmail.com wrote: If you do this, the user needs to take care to order the iteratees so that the last iteratee has small leftovers. Consider: manyToOne

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-29 Thread Dmitry Olshansky
In my case leftover is not important. But in common case... Just an idea... What if we provide iterWhile :: Iteratee a m () - Iteratee a m b - Iteratee a m b The first Iteratee only control when the result should be yeilded and feed an input to second Iteratee. Then we can change manyToOne to

[Haskell-cafe] Iteratee: manyToOne

2011-04-28 Thread Dmitry Olshansky
Hello, does somewhere exist function with type like this - manyToOne :: [Iteratee a m b] - Iteratee a m [b] ? I.e. I need to process one input through many Iteratees indepentently in constant space and collect results. It is similar by type with sequenceM but as far as I understand sequenceM

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-28 Thread Felipe Almeida Lessa
On Thu, Apr 28, 2011 at 11:39 AM, Dmitry Olshansky olshansk...@gmail.com wrote: Hello, does somewhere exist function with type like this - manyToOne :: [Iteratee a m b] - Iteratee a m [b] ? I.e. I need to process one input through many Iteratees indepentently in constant space and collect

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-28 Thread Felipe Almeida Lessa
On Thu, Apr 28, 2011 at 12:09 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: I foresee one problem: what is the leftover of 'manyToOne xs' if each x in xs needs different lengths of input? One possible untested-but-compiling solution: [snip] Like I said, that manyToOne implementation

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-28 Thread Felipe Almeida Lessa
On Thu, Apr 28, 2011 at 1:10 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: On Thu, Apr 28, 2011 at 12:09 PM, Felipe Almeida Lessa felipe.le...@gmail.com wrote: I foresee one problem: what is the leftover of 'manyToOne xs' if each x in xs needs different lengths of input? One

Re: [Haskell-cafe] Iteratee: manyToOne

2011-04-28 Thread Conrad Parker
On 28 April 2011 23:39, Dmitry Olshansky olshansk...@gmail.com wrote: Hello, does somewhere exist function with type like this - manyToOne :: [Iteratee a m b] - Iteratee a m [b] ? I.e. I need to process one input through many Iteratees indepentently in constant space and collect results.