Right, `toLazy` (and thus `toLazy_`, which just drops the final return value) 
return a strictly evaluated lazy bytestring. They are like `Pipes.ByteString` 
`toLazyM` and `Pipes.Prelude.toListM` and conduit things like `sinkList` and 
`sinkLazy`[^1] -- they all just make a "difference list" of each chunk or 
element, and then when the stream is done, compose them and apply to LBS.empty 
to make a lazy bytestring / lazy text / list . So you can't inspect the 
beginning without until you the whole materialized stream in memory.  (They 
don't have to write a new bytestring at least, they just recycle the references 
to the chunks.) The object of the game is to keep all that from happening, of 
course, though sometimes it is necessary.   I'm not sure I'm following the 
round-tripping through conduit in the snippets, are you working with a conduit 
source somewhere?

-- 
You received this message because you are subscribed to the Google Groups 
"Haskell Pipes" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to haskell-pipes+unsubscr...@googlegroups.com.
To post to this group, send email to haskell-pipes@googlegroups.com.

Reply via email to