Copyright | (c) Duncan Coutts 2015-2017 |
---|---|
License | BSD3-style (see LICENSE.txt) |
Maintainer | duncan@community.haskell.org |
Stability | experimental |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
High level API for encoding values, for later serialization into
CBOR binary format, using a
based interface.Monoid
Synopsis
- newtype Encoding = Encoding (Tokens -> Tokens)
- data Tokens
- = TkWord !Word Tokens
- | TkWord64 !Word64 Tokens
- | TkInt !Int Tokens
- | TkInt64 !Int64 Tokens
- | TkBytes !ByteString Tokens
- | TkBytesBegin Tokens
- | TkByteArray !SlicedByteArray Tokens
- | TkString !Text Tokens
- | TkUtf8ByteArray !SlicedByteArray Tokens
- | TkStringBegin Tokens
- | TkListLen !Word Tokens
- | TkListBegin Tokens
- | TkMapLen !Word Tokens
- | TkMapBegin Tokens
- | TkTag !Word Tokens
- | TkTag64 !Word64 Tokens
- | TkInteger !Integer Tokens
- | TkNull Tokens
- | TkUndef Tokens
- | TkBool !Bool Tokens
- | TkSimple !Word8 Tokens
- | TkFloat16 !Float Tokens
- | TkFloat32 !Float Tokens
- | TkFloat64 !Double Tokens
- | TkBreak Tokens
- | TkEncoded !ByteString Tokens
- | TkEnd
- encodeWord :: Word -> Encoding
- encodeWord8 :: Word8 -> Encoding
- encodeWord16 :: Word16 -> Encoding
- encodeWord32 :: Word32 -> Encoding
- encodeWord64 :: Word64 -> Encoding
- encodeInt :: Int -> Encoding
- encodeInt8 :: Int8 -> Encoding
- encodeInt16 :: Int16 -> Encoding
- encodeInt32 :: Int32 -> Encoding
- encodeInt64 :: Int64 -> Encoding
- encodeInteger :: Integer -> Encoding
- encodeBytes :: ByteString -> Encoding
- encodeBytesIndef :: Encoding
- encodeByteArray :: SlicedByteArray -> Encoding
- encodeString :: Text -> Encoding
- encodeStringIndef :: Encoding
- encodeUtf8ByteArray :: SlicedByteArray -> Encoding
- encodeListLen :: Word -> Encoding
- encodeListLenIndef :: Encoding
- encodeMapLen :: Word -> Encoding
- encodeMapLenIndef :: Encoding
- encodeBreak :: Encoding
- encodeTag :: Word -> Encoding
- encodeTag64 :: Word64 -> Encoding
- encodeBool :: Bool -> Encoding
- encodeUndef :: Encoding
- encodeNull :: Encoding
- encodeSimple :: Word8 -> Encoding
- encodeFloat16 :: Float -> Encoding
- encodeFloat :: Float -> Encoding
- encodeDouble :: Double -> Encoding
Encoding implementation
TkWord !Word Tokens | |
TkWord64 !Word64 Tokens | |
TkInt !Int Tokens | |
TkInt64 !Int64 Tokens | |
TkBytes !ByteString Tokens | |
TkBytesBegin Tokens | |
TkByteArray !SlicedByteArray Tokens | |
TkString !Text Tokens | |
TkUtf8ByteArray !SlicedByteArray Tokens | |
TkStringBegin Tokens | |
TkListLen !Word Tokens | |
TkListBegin Tokens | |
TkMapLen !Word Tokens | |
TkMapBegin Tokens | |
TkTag !Word Tokens | |
TkTag64 !Word64 Tokens | |
TkInteger !Integer Tokens | |
TkNull Tokens | |
TkUndef Tokens | |
TkBool !Bool Tokens | |
TkSimple !Word8 Tokens | |
TkFloat16 !Float Tokens | |
TkFloat32 !Float Tokens | |
TkFloat64 !Double Tokens | |
TkBreak Tokens | |
TkEncoded !ByteString Tokens | |
TkEnd |
Encoding
API for serialisation
Encoding
encodeWord :: Word -> Encoding #
encodeWord8 :: Word8 -> Encoding #
encodeWord16 :: Word16 -> Encoding #
encodeWord32 :: Word32 -> Encoding #
encodeWord64 :: Word64 -> Encoding #
encodeInt8 :: Int8 -> Encoding #
encodeInt16 :: Int16 -> Encoding #
encodeInt32 :: Int32 -> Encoding #
encodeInt64 :: Int64 -> Encoding #
encodeInteger :: Integer -> Encoding #
encodeBytes :: ByteString -> Encoding #
encodeByteArray :: SlicedByteArray -> Encoding #
encodeString :: Text -> Encoding #
encodeUtf8ByteArray :: SlicedByteArray -> Encoding #
encodeListLen :: Word -> Encoding #
encodeMapLen :: Word -> Encoding #
encodeBreak :: Encoding #
encodeTag64 :: Word64 -> Encoding #
encodeBool :: Bool -> Encoding #
encodeUndef :: Encoding #
encodeNull :: Encoding #
encodeSimple :: Word8 -> Encoding #
encodeFloat16 :: Float -> Encoding #
encodeFloat :: Float -> Encoding #
encodeDouble :: Double -> Encoding #