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

Portability | GHC
Maintainer | Simon Meier <iridcode@gmail.com>
Safe Haskell | None

Data.ByteString.Lazy.Builder.ASCII

Contents

- Decimal numbers
- Hexadecimal numbers
- Fixed-width hexadecimal numbers

Description

Constructing `Builder`s using ASCII-based encodings.

Synopsis

- int8Dec :: Int8 -> Builder
- int16Dec :: Int16 -> Builder
- int32Dec :: Int32 -> Builder
- int64Dec :: Int64 -> Builder
- intDec :: Int -> Builder
- integerDec :: Integer -> Builder
- word8Dec :: Word8 -> Builder
- word16Dec :: Word16 -> Builder
- word32Dec :: Word32 -> Builder
- word64Dec :: Word64 -> Builder
- wordDec :: Word -> Builder
- floatDec :: Float -> Builder
- doubleDec :: Double -> Builder
- word8Hex :: Word8 -> Builder
- word16Hex :: Word16 -> Builder
- word32Hex :: Word32 -> Builder
- word64Hex :: Word64 -> Builder
- wordHex :: Word -> Builder
- int8HexFixed :: Int8 -> Builder
- int16HexFixed :: Int16 -> Builder
- int32HexFixed :: Int32 -> Builder
- int64HexFixed :: Int64 -> Builder
- word8HexFixed :: Word8 -> Builder
- word16HexFixed :: Word16 -> Builder
- word32HexFixed :: Word32 -> Builder
- word64HexFixed :: Word64 -> Builder
- floatHexFixed :: Float -> Builder
- doubleHexFixed :: Double -> Builder
- byteStringHexFixed :: ByteString -> Builder
- lazyByteStringHexFixed :: ByteString -> Builder

# Decimal numbers

Decimal encoding of numbers using ASCII encoded characters.

int8Dec :: Int8 -> Builder

Decimal encoding of an `Int8` using the ASCII digits.

e.g.

     toLazyByteString (int8Dec 42)   = "42"
     toLazyByteString (int8Dec (-1)) = "-1"

int16Dec :: Int16 -> Builder

Decimal encoding of an `Int16` using the ASCII digits.

int32Dec :: Int32 -> Builder

Decimal encoding of an `Int32` using the ASCII digits.

int64Dec :: Int64 -> Builder

Decimal encoding of an `Int64` using the ASCII digits.

intDec :: Int -> Builder

Decimal encoding of an `Int` using the ASCII digits.

integerDec :: Integer -> Builder

Currently slow. Decimal encoding of an `Integer` using the ASCII digits.

word8Dec :: Word8 -> Builder

Decimal encoding of a `Word8` using the ASCII digits.

word16Dec :: Word16 -> Builder

Decimal encoding of a `Word16` using the ASCII digits.

word32Dec :: Word32 -> Builder

Decimal encoding of a `Word32` using the ASCII digits.

word64Dec :: Word64 -> Builder

Decimal encoding of a `Word64` using the ASCII digits.

wordDec :: Word -> Builder

Decimal encoding of a `Word` using the ASCII digits.

floatDec :: Float -> Builder

Currently slow. Decimal encoding of an IEEE `Float`.

doubleDec :: Double -> Builder

Currently slow. Decimal encoding of an IEEE `Double`.

# Hexadecimal numbers

Encoding positive integers as hexadecimal numbers using lower-case ASCII characters. The shortest possible representation is used. For example,

    >>> toLazyByteString (word16Hex 0x0a10)
    Chunk "a10" Empty

Note that there is no support for using upper-case characters. Please contact the maintainer, if your application cannot work without hexadecimal encodings that use upper-case characters.

word8Hex :: Word8 -> Builder

Shortest hexadecimal encoding of a `Word8` using lower-case characters.

word16Hex :: Word16 -> Builder

Shortest hexadecimal encoding of a `Word16` using lower-case characters.

word32Hex :: Word32 -> Builder

Shortest hexadecimal encoding of a `Word32` using lower-case characters.

word64Hex :: Word64 -> Builder

Shortest hexadecimal encoding of a `Word64` using lower-case characters.

wordHex :: Word -> Builder

Shortest hexadecimal encoding of a `Word` using lower-case characters.

# Fixed-width hexadecimal numbers

int8HexFixed :: Int8 -> Builder

Encode a `Int8` using 2 nibbles (hexadecimal digits).

int16HexFixed :: Int16 -> Builder

Encode a `Int16` using 4 nibbles.

int32HexFixed :: Int32 -> Builder

Encode a `Int32` using 8 nibbles.

int64HexFixed :: Int64 -> Builder

Encode a `Int64` using 16 nibbles.

word8HexFixed :: Word8 -> Builder

Encode a `Word8` using 2 nibbles (hexadecimal digits).

word16HexFixed :: Word16 -> Builder

Encode a `Word16` using 4 nibbles.

word32HexFixed :: Word32 -> Builder

Encode a `Word32` using 8 nibbles.

word64HexFixed :: Word64 -> Builder

Encode a `Word64` using 16 nibbles.

floatHexFixed :: Float -> Builder

Encode an IEEE `Float` using 8 nibbles.

doubleHexFixed :: Double -> Builder

Encode an IEEE `Double` using 16 nibbles.

byteStringHexFixed :: ByteString -> Builder

Encode each byte of a `ByteString` using its fixed-width hex encoding.

lazyByteStringHexFixed :: ByteString -> Builder

Encode each byte of a lazy `ByteString` using its fixed-width hex encoding.