Safe Haskell | Trustworthy |
---|---|
Language | Haskell2010 |
Synopsis
- class BytePacker p where
- pack :: MessagePack a => p -> a -> ByteString
- unpackValidate :: MessagePack a => p -> ByteString -> Validate DecodeError a
- unpackEither :: (BytePacker p, MessagePack a) => p -> ByteString -> Either DecodeError a
- unpack :: (BytePacker p, Monad m, MonadFail m, MessagePack a) => p -> ByteString -> m a
Documentation
class BytePacker p where Source #
pack :: MessagePack a => p -> a -> ByteString Source #
Pack a Haskell value to MessagePack binary.
unpackValidate :: MessagePack a => p -> ByteString -> Validate DecodeError a Source #
Unpack MessagePack binary to a Haskell value.
On failure, returns a list of error messages.
unpackEither :: (BytePacker p, MessagePack a) => p -> ByteString -> Either DecodeError a Source #
unpack :: (BytePacker p, Monad m, MonadFail m, MessagePack a) => p -> ByteString -> m a Source #
Unpack MessagePack binary to a Haskell value. If it fails, it fails in the Monad. In the Maybe monad, failure returns Nothing.