|Portability||portable to Hugs and GHC|
|Maintainer||Adam Langley <email@example.com>|
Efficient construction of lazy bytestrings, bit by bit.
- data BitBuilder
- toLazyByteString :: BitBuilder -> ByteString
- empty :: BitBuilder
- singleton :: Bool -> BitBuilder
- append :: BitBuilder -> BitBuilder -> BitBuilder
- fromByteString :: (ByteString, Int) -> BitBuilder
- fromLazyByteString :: ByteString -> BitBuilder
- fromBits :: (Integral a, Bits a) => Int -> a -> BitBuilder
- flush :: BitBuilder
The Builder type
BitBuilder is an efficient way to build lazy
There are several functions for constructing
BitBuilders, but only one
to inspect them: to extract any data, you have to turn them into lazy
BitBuilder constructs a lazy
L.Bytestring by filling byte
arrays piece by piece. As each buffer is filled, it is 'popped'
off, to become a new chunk of the resulting lazy
All this is hidden from the user of the
This is closely based on the Builder monad, but this one deals with single bits at a time.
Construct a BitBuilder by taking the bottom n bits of a Bits instance. If the instance has less than n bits, this acts as if there was an infinite zero filled prefix