Copyright | (c) 2010 - 2011 Simon Meier |
---|---|
License | BSD3-style (see LICENSE) |
Maintainer | Simon Meier <iridcode@gmail.com> |
Portability | GHC |
Safe Haskell | None |
Language | Haskell98 |
Constructing Builder
s using ASCII-based encodings.
- 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 Source
Decimal encoding of an Int8
using the ASCII digits.
e.g.
toLazyByteString (int8Dec 42) = "42" toLazyByteString (int8Dec (-1)) = "-1"
integerDec :: Integer -> Builder Source
Currently slow. Decimal encoding of an Integer
using the ASCII digits.
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 Source
Shortest hexadecimal encoding of a Word8
using lower-case characters.
word16Hex :: Word16 -> Builder Source
Shortest hexadecimal encoding of a Word16
using lower-case characters.
word32Hex :: Word32 -> Builder Source
Shortest hexadecimal encoding of a Word32
using lower-case characters.
word64Hex :: Word64 -> Builder Source
Shortest hexadecimal encoding of a Word64
using lower-case characters.
wordHex :: Word -> Builder Source
Shortest hexadecimal encoding of a Word
using lower-case characters.
Fixed-width hexadecimal numbers
int8HexFixed :: Int8 -> Builder Source
Encode a Int8
using 2 nibbles (hexadecimal digits).
int16HexFixed :: Int16 -> Builder Source
Encode a Int16
using 4 nibbles.
int32HexFixed :: Int32 -> Builder Source
Encode a Int32
using 8 nibbles.
int64HexFixed :: Int64 -> Builder Source
Encode a Int64
using 16 nibbles.
word8HexFixed :: Word8 -> Builder Source
Encode a Word8
using 2 nibbles (hexadecimal digits).
word16HexFixed :: Word16 -> Builder Source
Encode a Word16
using 4 nibbles.
word32HexFixed :: Word32 -> Builder Source
Encode a Word32
using 8 nibbles.
word64HexFixed :: Word64 -> Builder Source
Encode a Word64
using 16 nibbles.
floatHexFixed :: Float -> Builder Source
Encode an IEEE Float
using 8 nibbles.
doubleHexFixed :: Double -> Builder Source
Encode an IEEE Double
using 16 nibbles.
byteStringHexFixed :: ByteString -> Builder Source
Encode each byte of a ByteString
using its fixed-width hex encoding.
lazyByteStringHexFixed :: ByteString -> Builder Source
Encode each byte of a lazy ByteString
using its fixed-width hex encoding.