Re: [Haskell-cafe] Auto-termination and leftovers in Conduits

2012-10-28 Thread Myles C. Maxfield
Cool! Thanks so much! --Myles On Sat, Oct 27, 2012 at 8:35 PM, Michael Snoyman mich...@snoyman.com wrote: The important issue here is that, when using =$, $=, and =$=, leftovers will discarded. To see this more clearly, realize that the first line of sink is equivalent to: out1 -

[Haskell-cafe] Auto-termination and leftovers in Conduits

2012-10-27 Thread Myles C. Maxfield
Hey, Say I have a stream of Data.Text.Text objects flowing through a conduit, where the divisions between successive Data.Text.Text items occur at arbitrary boundaries (maybe the source is sourceFile $= decode utf8). I'd like to create a Sink that returns a tuple of (the first line, the rest of

Re: [Haskell-cafe] Auto-termination and leftovers in Conduits

2012-10-27 Thread Michael Snoyman
The important issue here is that, when using =$, $=, and =$=, leftovers will discarded. To see this more clearly, realize that the first line of sink is equivalent to: out1 - C.injectLeftovers CT.lines C.+ CL.head So any leftovers from lines are lost once you move past that line. In order to