Yes, that's a fair explanation.
On Tue, Apr 9, 2013 at 7:48 AM, Magicloud Magiclouds <
magicloud.magiclo...@gmail.com> wrote:
> Thank you for the reply. I've learnt the code of "lines". So it is because
> how ByteString works, that the conduit is not a stream of bytes, but
> chunks, right?
>
>
>
Thank you for the reply. I've learnt the code of "lines". So it is because
how ByteString works, that the conduit is not a stream of bytes, but
chunks, right?
On Tue, Apr 9, 2013 at 12:12 PM, Michael Snoyman wrote:
> It's a bug in your implementation of takeLine I believe. It doesn't take
> into
It's a bug in your implementation of takeLine I believe. It doesn't take
into account that lines can span multiple chunks. When you call takeLine
the first time, you get "L1\n". leftover puts a chunk with exactly those
contents back. When you call takeLine the second time, it gets the chunk
"L1\n",
Say I have code like below. If I comment the leftover in main, I got (Just
"L1\n", Just "L2\n", Just "L3\n", Just "L4\n"). But if I did not comment
the leftover, then I got (Just "L1\n", Just "L1\n", Just "", Just "L2\n").
Why is not it (Just "L1\n", Just "L1\n", Just "L2\n", Just "L3\n")?
takeLin