bytestring-0.10.8.1: Fast, compact, strict and lazy byte strings with a list interface

Copyright(c) 2010 Jasper Van der Jeugt (c) 2010 - 2011 Simon Meier
LicenseBSD3-style (see LICENSE)
MaintainerSimon Meier <iridcode@gmail.com>
PortabilityGHC
Safe HaskellTrustworthy
LanguageHaskell98

Data.ByteString.Builder

Contents

Description

Builders are used to efficiently construct sequences of bytes from smaller parts. Typically, such a construction is part of the implementation of an encoding, i.e., a function for converting Haskell values to sequences of bytes. Examples of encodings are the generation of the sequence of bytes representing a HTML document to be sent in a HTTP response by a web application or the serialization of a Haskell value using a fixed binary format.

For an efficient implementation of an encoding, it is important that (a) little time is spent on converting the Haskell values to the resulting sequence of bytes and (b) that the representation of the resulting sequence is such that it can be consumed efficiently. Builders support (a) by providing an O(1) concatentation operation and efficient implementations of basic encodings for Chars, Ints, and other standard Haskell values. They support (b) by providing their result as a lazy