-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | A Haskell binding to MessagePack
--
@package msgpack
@version 0.1.0
-- | Low Level Interface to MessagePack C API
module Data.MessagePack.Base
type SimpleBuffer = ForeignPtr ()
-- | Create a new Simple Buffer. It will be deleted automatically.
newSimpleBuffer :: IO SimpleBuffer
-- | Get data of Simple Buffer.
simpleBufferData :: SimpleBuffer -> IO ByteString
type Packer = ForeignPtr ()
-- | Create new Packer. It will be deleted automatically.
newPacker :: SimpleBuffer -> IO Packer
packU8 :: Packer -> Word8 -> IO Int
packU16 :: Packer -> Word16 -> IO Int
packU32 :: Packer -> Word32 -> IO Int
packU64 :: Packer -> Word64 -> IO Int
packS8 :: Packer -> Int8 -> IO Int
packS16 :: Packer -> Int16 -> IO Int
packS32 :: Packer -> Int32 -> IO Int
packS64 :: Packer -> Int64 -> IO Int
packTrue :: Packer -> IO Int
packFalse :: Packer -> IO Int
-- | Pack an integral data.
packInt :: Integral a => Packer -> a -> IO Int
-- | Pack a double data.
packDouble :: Packer -> Double -> IO Int
-- | Pack a nil.
packNil :: Packer -> IO Int
-- | Pack a bool data.
packBool :: Packer -> Bool -> IO Int
-- | packArray p n starts packing an array. Next n
-- data will consist this array.
packArray :: Packer -> Int -> IO Int
-- | packMap p n starts packing a map. Next n
-- pairs of data (2*n data) will consist this map.
packMap :: Packer -> Int -> IO Int
-- | packRAW p n starts packing a byte sequence. Next total
-- n bytes of packRAWBody call will consist this
-- sequence.
packRAW :: Packer -> Int -> IO Int
-- | Pack a byte sequence.
packRAWBody :: Packer -> ByteString -> IO Int
-- | Pack a single byte stream. It calls packRAW and
-- packRAWBody.
packRAW' :: Packer -> ByteString -> IO Int
type Unpacker = ForeignPtr ()
defaultInitialBufferSize :: Int
-- | newUnpacker initialBufferSize creates a new Unpacker.
-- It will be deleted automatically.
newUnpacker :: Int -> IO Unpacker
-- | unpackerReserveBuffer up size reserves at least
-- size bytes of buffer.
unpackerReserveBuffer :: Unpacker -> Int -> IO Bool
-- | Get a pointer of unpacker buffer.
unpackerBuffer :: Unpacker -> IO (Ptr CChar)
-- | Get size of allocated buffer.
unpackerBufferCapacity :: Unpacker -> IO Int
-- | unpackerBufferConsumed up size notices that writed
-- size bytes to buffer.
unpackerBufferConsumed :: Unpacker -> Int -> IO ()
-- | Write byte sequence to Unpacker. It is utility funciton, calls
-- unpackerReserveBuffer, unpackerBuffer and
-- unpackerBufferConsumed.
unpackerFeed :: Unpacker -> ByteString -> IO ()
-- | Execute deserializing. It returns 0 when buffer contains not enough
-- bytes, returns 1 when succeeded, returns negative value when it
-- failed.
unpackerExecute :: Unpacker -> IO Int
-- | Returns a deserialized object when unpackerExecute returned 1.
unpackerData :: Unpacker -> IO Object
-- | Release memory zone. The returned zone must be freed by calling
-- freeZone.
unpackerReleaseZone :: Unpacker -> IO Zone
-- | Free memory zone used by Unapcker.
unpackerResetZone :: Unpacker -> IO ()
-- | Reset Unpacker state except memory zone.
unpackerReset :: Unpacker -> IO ()
-- | Returns number of bytes of sequence of deserializing object.
unpackerMessageSize :: Unpacker -> IO Int
-- | Object Representation of MessagePack data.
data Object
ObjectNil :: Object
ObjectBool :: Bool -> Object
ObjectInteger :: Int -> Object
ObjectDouble :: Double -> Object
ObjectRAW :: ByteString -> Object
ObjectArray :: [Object] -> Object
ObjectMap :: [(Object, Object)] -> Object
-- | Pack a Object.
packObject :: Packer -> Object -> IO ()
data UnpackReturn
-- | not enough bytes to unpack object
UnpackContinue :: UnpackReturn
-- | got invalid bytes
UnpackParseError :: UnpackReturn
-- | other error
UnpackError :: UnpackReturn
-- | Unpack a single MessagePack object from byte sequence.
unpackObject :: Zone -> ByteString -> IO (Either UnpackReturn (Int, Object))
type Zone = Ptr ()
-- | Create a new memory zone. It must be freed manually.
newZone :: IO Zone
-- | Free a memory zone.
freeZone :: Zone -> IO ()
-- | Create a memory zone, then execute argument, then free memory zone.
withZone :: (Zone -> IO a) -> IO a
instance [incoherent] Show Object
instance [incoherent] Eq UnpackReturn
instance [incoherent] Show UnpackReturn
-- | Serializing Haskell values to and from MessagePack Objects.
module Data.MessagePack.Class
-- | The class of types serializable to and from MessagePack object
class OBJECT a
toObject :: OBJECT a => a -> Object
fromObject :: OBJECT a => Object -> Result a
-- | A type for parser results
type Result a = Either String a
-- | Pack a serializable Haskell value.
pack :: OBJECT a => Packer -> a -> IO ()
instance [overlap ok] OBJECT a => OBJECT (Maybe a)
instance [overlap ok] (OBJECT a, OBJECT b) => OBJECT [(a, b)]
instance [overlap ok] OBJECT a => OBJECT [a]
instance [overlap ok] OBJECT String
instance [overlap ok] OBJECT ByteString
instance [overlap ok] OBJECT Double
instance [overlap ok] OBJECT Bool
instance [overlap ok] OBJECT Int
instance [overlap ok] OBJECT Object
-- | Simple interface to pack and unpack MessagePack data.
module Data.MessagePack
-- | Pack Haskell data to MessagePack string.
packb :: OBJECT a => a -> IO ByteString
-- | Unpack MessagePack string to Haskell data.
unpackb :: OBJECT a => ByteString -> IO (Result a)
-- | Pure version of packb.
packb' :: OBJECT a => a -> ByteString
-- | Pure version of unpackb.
unpackb' :: OBJECT a => ByteString -> Result a