Fast, compact, strict and lazy byte strings with a list interface
|Version on this page:||0.10.4.0|
|LTS Haskell 20.23:||0.11.4.0|
|Stackage Nightly 2023-05-31:||0.11.4.0|
|Latest on Hackage:||0.11.4.0|
Module documentation for 0.10.4.0
An efficient compact, immutable byte string type (both strict and lazy) suitable for binary or 8-bit character data.
ByteString type represents sequences of bytes or 8-bit characters.
It is suitable for high performance use, both in terms of large data
quantities, or high speed requirements. The
ByteString functions follow
the same style as Haskell's ordinary lists, so it is easy to convert code
ByteString variants are provided:
ByteStrings keep the string as a single large array. This makes them convenient for passing data between C and Haskell.
ByteStrings use a lazy list of strict chunks which makes it suitable for I/O streaming tasks.
Char8 modules provide a character-based view of the same
ByteString types. This makes it convenient to handle mixed
binary and 8-bit character content (which is common in many file formats
and network protocols).
Builder module provides an efficient way to build up
in an ad-hoc way by repeated concatenation. This is ideal for fast
serialisation or pretty printing.
There is also a
ShortByteString type which has a lower memory overhead
and can can be converted to or from a
ByteString, but supports very few
other operations. It is suitable for keeping many short strings in memory.
ByteStrings are not designed for Unicode. For Unicode strings you should
Text type from the
These modules are intended to be imported qualified, to avoid name clashes
Prelude functions, e.g.
import qualified Data.ByteString as BS