Transform a builder such that it uses chunked HTTP transfer encoding.
:set -XOverloadedStringsimport Data.ByteString.Builder as Blet f = B.toLazyByteString . chunkedTransferEncoding . B.lazyByteStringf "data""004\r\ndata\r\n"
f """"
Note: While for many inputs, the bytestring chunks that can be obtained from the output
via toChunks . toLazyByteString
each form a chunk in the sense
of RFC 7230 Section 4.1,
this correspondence doesn't hold in general.