On Tue, Nov 18, 2014 at 4:59 PM, Thomas Koster <tkoster@gmail.com> wrote:
Why does version A not process the LBS in constant space?

The lazy bytestring is let-lifted out of the function so that subsequent calls reuse the same heap value.
 
What in version A is preventing the GC from collecting the LBS chunks
after they have been fed to Warp?

The value is re-used (and the closure holds a reference) so the GC can't collect it.

What is it about version B that permits the LBS chunks to be collected?

The allocation is performed underneath the lambda in version B and so you get a fresh copy every time.

G
--
Gregory Collins <greg@gregorycollins.net>