Re: [Haskell-cafe] Conduit experiment: Is this correct?

2012-02-04 Thread Michael Snoyman
I thought about it a bit more. The problem would actually be *very* easy to solve if conduit exported one extra function: a connect function that returned a Sink instead of running it. Then you could do: bsrc - bufferSource src sink2 - (bsrc $= Cb.lines $= Cl.isolate 3)

Re: [Haskell-cafe] Conduit experiment: Is this correct?

2012-02-03 Thread Michael Snoyman
2012/2/3 Ertugrul Söylemez e...@ertes.de: Hello there, I'm trying to build a server for testing the conduit and network-conduit packages.  As a contrived example the goal is to pick the first three lines from the client and send them back without the line feeds.  After that, I'd like to

Re: [Haskell-cafe] Conduit experiment: Is this correct?

2012-02-03 Thread yi huang
2012/2/3 Michael Snoyman mich...@snoyman.com 2012/2/3 Ertugrul Söylemez e...@ertes.de: Hello there, I'm trying to build a server for testing the conduit and network-conduit packages. As a contrived example the goal is to pick the first three lines from the client and send them back

Re: [Haskell-cafe] Conduit experiment: Is this correct?

2012-02-03 Thread Ertugrul Söylemez
Michael Snoyman mich...@snoyman.com wrote: In this particular case, it will work due to the implementation of snk. In general, however, you're correct: you should not use the same sink twice. I haven't thought about it much yet, but my initial recommendation would be to create a new Conduit

Re: [Haskell-cafe] Conduit experiment: Is this correct?

2012-02-03 Thread Felipe Almeida Lessa
On Fri, Feb 3, 2012 at 1:38 PM, yi huang yi.codepla...@gmail.com wrote: Since Sink works in a CPS fashion, by which i mean every step it return a new push close pair, i think it can be used multiple time. Actually, this is exactly why it *can't* be used multiple times. Cheers! -- Felipe.

Re: [Haskell-cafe] Conduit experiment: Is this correct?

2012-02-03 Thread Ertugrul Söylemez
Michael Snoyman mich...@snoyman.com wrote: In this particular case, it will work due to the implementation of snk. In general, however, you're correct: you should not use the same sink twice. I haven't thought about it much yet, but my initial recommendation would be to create a new Conduit

Re: [Haskell-cafe] Conduit experiment: Is this correct?

2012-02-03 Thread Erik de Castro Lopo
Ertugrul Söylemez wrote: Thanks a lot. This conduit world is really new to me and feels a bit more complicated than enumerators, but at least I seem to be getting the right intuition. I can assure you that while this may be true for simple cases, it most definitely is not true for at least