[Haskell-cafe] fine control of bytestring streaming

Alberto G. Corona agocorona at gmail.com
Tue Jul 27 17:25:25 EDT 2010


I´m streaming content using lazy bytestrings in a web application. The
problem is that the output comes in huge blobs  (presumably of 32k)
one at a time. This is good for some purposes, but not for
console-like interfaces or runtime log visualization. (one of my
purposes is to web-alize ghci. I know that this can be done without
streaming the standard output, but I want it that way).

I can not  control when the IO bytestring primitives flush the data to
the stream, because this is not part of my application (nor does it
should do it).

 I suppose here that it is in a chunk by chunk basis. But maybe I
misinterpreted something or everything. I use the package hack with
the server  hack-handler-simpleserver. this serves does
Data.ByteString.hPut   the bytestring content...

I use mappend to add content to the stream.  mappend uses "append"
which uses. "foldrChunks" which  seems not to compact two bytestrings
in  max size chunks . So I do not know what happens.

The question is:  are there some way to control bytestring streaming?.
 Can It be done without the stream handler?


More information about the Haskell-Cafe mailing list