Copyright | (c) Fumiaki Kinoshita 2020- |
---|---|
License | BSD3 |
Maintainer | Fumiaki Kinoshita <fumiexcel@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
API which is almost compatible with Data.ByteString.Builder
Synopsis
- type Builder = DynBuilder
- toStrictByteString :: DynBuilder -> ByteString
- toLazyByteString :: DynBuilder -> ByteString
- hPutBuilderLen :: Handle -> DynBuilder -> IO Int
- hPutBuilder :: Handle -> DynBuilder -> IO ()
- sendBuilder :: Socket -> DynBuilder -> IO Int
- flush :: Buildable s => BuilderFor s
- byteString :: Buildable s => ByteString -> BuilderFor s
- lazyByteString :: ByteString -> Builder
- shortByteString :: ShortByteString -> Builder
- textUtf8 :: Text -> Builder
- encodeUtf8Builder :: Text -> Builder
- encodeUtf8BuilderEscaped :: Buildable s => BoundedPrim Word8 -> Text -> BuilderFor s
- char7 :: Char -> Builder
- string7 :: String -> Builder
- char8 :: Char -> Builder
- string8 :: String -> Builder
- charUtf8 :: Char -> Builder
- stringUtf8 :: Buildable s => String -> BuilderFor s
- storable :: Storable a => a -> Builder
- int8 :: Int8 -> Builder
- word8 :: Word8 -> Builder
- int16LE :: Int16 -> Builder
- int32LE :: Int32 -> Builder
- int64LE :: Int64 -> Builder
- word16LE :: Word16 -> Builder
- word32LE :: Word32 -> Builder
- word64LE :: Word64 -> Builder
- floatLE :: Float -> Builder
- doubleLE :: Double -> Builder
- int16BE :: Int16 -> Builder
- int32BE :: Int32 -> Builder
- int64BE :: Int64 -> Builder
- word16BE :: Word16 -> Builder
- word32BE :: Word32 -> Builder
- word64BE :: Word64 -> Builder
- floatBE :: Float -> Builder
- doubleBE :: Double -> Builder
- floatDec :: Float -> Builder
- doubleDec :: Double -> Builder
- doubleSI :: Int -> Double -> Builder
- doubleExp :: Int -> Double -> Builder
- doubleFixed :: Int -> Double -> Builder
- word8Dec :: Word8 -> Builder
- word16Dec :: Word16 -> Builder
- word32Dec :: Word32 -> Builder
- word64Dec :: Word64 -> Builder
- wordDec :: Word -> Builder
- int8Dec :: Int8 -> Builder
- int16Dec :: Int16 -> Builder
- int32Dec :: Int32 -> Builder
- int64Dec :: Int64 -> Builder
- intDec :: Int -> Builder
- integerDec :: Integer -> 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
- byteStringHex :: ByteString -> Builder
- lazyByteStringHex :: ByteString -> Builder
Documentation
type Builder = DynBuilder Source #
Runners
hPutBuilderLen :: Handle -> DynBuilder -> IO Int Source #
hPutBuilder :: Handle -> DynBuilder -> IO () Source #
sendBuilder :: Socket -> DynBuilder -> IO Int Source #
Primitives
flush :: Buildable s => BuilderFor s Source #
Flush the content of the internal buffer.
Bytes
byteString :: Buildable s => ByteString -> BuilderFor s Source #
Put a ByteString
.
lazyByteString :: ByteString -> Builder Source #
Combine chunks of a lazy ByteString
shortByteString :: ShortByteString -> Builder Source #
Copy a ShortByteString
to a buffer.
Text
encodeUtf8Builder :: Text -> Builder Source #
encodeUtf8BuilderEscaped :: Buildable s => BoundedPrim Word8 -> Text -> BuilderFor s Source #
Encode Text
with a custom escaping function
stringUtf8 :: Buildable s => String -> BuilderFor s Source #
UTF-8 encode a String
.
Primitive
Numeral
Attach an SI prefix so that abs(mantissa) is within [1, 1000). Omits c, d, da and h.
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 #
Decimal encoding of an Integer
using the ASCII digits.
Simon Meier's improved implementation from https://github.com/haskell/bytestring/commit/92f19a5d94761042b44a433d7331107611e4d717
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.
byteStringHex :: ByteString -> Builder Source #
Encode each byte of a ByteString
using its fixed-width hex encoding.
lazyByteStringHex :: ByteString -> Builder Source #
Encode each byte of a lazy ByteString
using its fixed-width hex encoding.