Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module contains helper functions when dealing with encoding
and decoding Binary
Synopsis
- newtype UnpackError = UnpackError {}
- ensureEnd :: Get ()
- launchGet :: Get a -> LByteString -> Either UnpackError a
- data TaggedDecoder a = TaggedDecoder {}
- (#:) :: Word8 -> Get a -> TaggedDecoder a
- decodeBytesLike :: Buildable err => String -> (ByteString -> Either err a) -> Get a
- decodeWithTag :: String -> [TaggedDecoder a] -> Get a
- getByteStringCopy :: Int -> Get ByteString
- getRemainingByteStringCopy :: Get ByteString
- unknownTag :: String -> Word8 -> Get a
Documentation
newtype UnpackError Source #
Any decoding error.
Instances
Eq UnpackError Source # | |
Defined in Util.Binary (==) :: UnpackError -> UnpackError -> Bool # (/=) :: UnpackError -> UnpackError -> Bool # | |
Show UnpackError Source # | |
Defined in Util.Binary showsPrec :: Int -> UnpackError -> ShowS # show :: UnpackError -> String # showList :: [UnpackError] -> ShowS # | |
Exception UnpackError Source # | |
Defined in Util.Binary | |
Buildable UnpackError Source # | |
Defined in Util.Binary build :: UnpackError -> Builder # |
launchGet :: Get a -> LByteString -> Either UnpackError a Source #
data TaggedDecoder a Source #
Describes how decodeWithTag
should decode tag-dependent data.
We expect bytes of such structure: tdTag
followed by a bytestring
which will be parsed with tdDecoder
.
(#:) :: Word8 -> Get a -> TaggedDecoder a infixr 0 Source #
Alias for TaggedDecoder
constructor.
decodeBytesLike :: Buildable err => String -> (ByteString -> Either err a) -> Get a Source #
decodeWithTag :: String -> [TaggedDecoder a] -> Get a Source #
getByteStringCopy :: Int -> Get ByteString Source #
Get a bytestring of the given length leaving no references to the original data in serialized form.
getRemainingByteStringCopy :: Get ByteString Source #
Get remaining available bytes.
Note that reading all remaining decoded input may be expensive and is thus
discouraged, use can use this function only when you know that amount
of data to be consumed is limited, e.g. within decodeAsBytes
call.