blaze-builder: Efficient buffered output.

[ bsd3, data, library ] [ Propose Tags ]

This library provides an implementation of the older blaze-builder interface in terms of the new builder that shipped with bytestring-

This implementation is mostly intended as a bridge to the new builder, so that code that uses the old interface can interoperate with code that uses the new implementation. Note that no attempt has been made to preserve the old internal modules, so code that has these dependencies cannot use this interface.

New code should, for the most part, use the new interface. However, this module does implement a chunked HTTP encoding, which is not otherwise implemented (yet?) with the new builder.

[Skip to Readme]
Versions [faq] 0.1,,,,,,,,,,,,,,,,,,,,,,,,
Change log CHANGES
Dependencies base (==4.*), bytestring (>=0.9 && <1.0), bytestring-builder, deepseq, semigroups (>=0.16 && <0.19), text (>=0.10 && <1.3) [details]
License BSD-3-Clause
Copyright (c) 2010-2014 Simon Meier (c) 2010 Jasper Van der Jeugt (c) 2013-2015 Leon P Smith
Author Jasper Van der Jeugt, Simon Meier, Leon P Smith
Maintainer Leon Smith <>
Category Data
Home page
Bug tracker
Source repo head: git clone
Uploaded by JasperVanDerJeugt at Wed Mar 14 21:11:56 UTC 2018
Distributions Arch:, Debian:, Fedora:, FreeBSD:, LTSHaskell:, NixOS:, Stackage:, openSUSE:
Downloads 289478 total (941 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2018-03-14 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for blaze-builder-

[back to package description]


Continuous Integration status Hackage page (downloads and API reference)

This library allows to efficiently serialize Haskell values to lazy bytestrings with a large average chunk size. The large average chunk size allows to make good use of cache prefetching in later processing steps (e.g. compression) and reduces the system call overhead when writing the resulting lazy bytestring to a file or sending it over the network.

This library was inspired by the module Data.Binary.Builder provided by the binary package. It was originally developed with the specific needs of the blaze-html package in mind. Since then it has been restructured to serve as a drop-in replacement for Data.Binary.Builder, which it improves upon both in speed as well as expressivity.

To see the improvements in speed, run the throughput benchmark, which measures serialization speeds for writing Word8, Word16, Word32 and Word64 in different endian formats and different chunk sizes, using the command

make bench-throughput

or run the list serialization comparison benchmark

make bench-blaze-vs-binary

Checkout the combinators in the module "Blaze.ByteString.Builder.Write" to see the improvements in expressivity. This module allows to incorporate efficient primitive buffer manipulations as parts of a builder. We use this facility in the 'blaze-html' HTML templating library to allow for the efficient serialization of HTML escaped and UTF-8 encoded characters.