A continuation-based decoder, used for decoding values that were previously encoded using the Codec.CBOR.Encoding module. As Decoder has a Monad instance, you can easily write Decoders monadically for building your deserialisation logic.
Moduleserialise-0.2.6.1Haskell2010
Codec.Serialise.Decoding
High level API for decoding values that were encoded with the
Codec.Serialise.Encoding module, using a Monad
based interface.
- 3 types
- 40 values
- Packageserialise-0.2.6.1
- Exports43
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceDecoding.hs
Decode primitive operations
3 declarationsAn action, representing a step for a decoder to taken and a continuation to invoke with the expected value.
Constructors
ConsumeWord (Word# -> ST s (DecodeAction s a))ConsumeWord8 (Word# -> ST s (DecodeAction s a))ConsumeWord16 (Word# -> ST s (DecodeAction s a))ConsumeWord32 (Word# -> ST s (DecodeAction s a))ConsumeNegWord (Word# -> ST s (DecodeAction s a))ConsumeInt (Int# -> ST s (DecodeAction s a))ConsumeInt8 (Int# -> ST s (DecodeAction s a))ConsumeInt16 (Int# -> ST s (DecodeAction s a))ConsumeInt32 (Int# -> ST s (DecodeAction s a))ConsumeListLen (Int# -> ST s (DecodeAction s a))ConsumeMapLen (Int# -> ST s (DecodeAction s a))ConsumeTag (Word# -> ST s (DecodeAction s a))ConsumeInteger (Integer -> ST s (DecodeAction s a))ConsumeFloat (Float# -> ST s (DecodeAction s a))ConsumeDouble (Double# -> ST s (DecodeAction s a))ConsumeBytes (ByteString -> ST s (DecodeAction s a))ConsumeByteArray (ByteArray -> ST s (DecodeAction s a))ConsumeString (Text -> ST s (DecodeAction s a))ConsumeUtf8ByteArray (ByteArray -> ST s (DecodeAction s a))ConsumeBool (Bool -> ST s (DecodeAction s a))ConsumeSimple (Word# -> ST s (DecodeAction s a))ConsumeBytesIndef (ST s (DecodeAction s a))ConsumeStringIndef (ST s (DecodeAction s a))ConsumeListLenIndef (ST s (DecodeAction s a))ConsumeMapLenIndef (ST s (DecodeAction s a))ConsumeNull (ST s (DecodeAction s a))ConsumeListLenOrIndef (Int# -> ST s (DecodeAction s a))ConsumeMapLenOrIndef (Int# -> ST s (DecodeAction s a))ConsumeBreakOr (Bool -> ST s (DecodeAction s a))PeekTokenType (TokenType -> ST s (DecodeAction s a))PeekAvailable (Int# -> ST s (DecodeAction s a))PeekByteOffset (Int# -> ST s (DecodeAction s a))ConsumeWordCanonical (Word# -> ST s (DecodeAction s a))ConsumeWord8Canonical (Word# -> ST s (DecodeAction s a))ConsumeWord16Canonical (Word# -> ST s (DecodeAction s a))ConsumeWord32Canonical (Word# -> ST s (DecodeAction s a))ConsumeNegWordCanonical (Word# -> ST s (DecodeAction s a))ConsumeIntCanonical (Int# -> ST s (DecodeAction s a))ConsumeInt8Canonical (Int# -> ST s (DecodeAction s a))ConsumeInt16Canonical (Int# -> ST s (DecodeAction s a))ConsumeInt32Canonical (Int# -> ST s (DecodeAction s a))ConsumeListLenCanonical (Int# -> ST s (DecodeAction s a))ConsumeMapLenCanonical (Int# -> ST s (DecodeAction s a))ConsumeTagCanonical (Word# -> ST s (DecodeAction s a))ConsumeIntegerCanonical (Integer -> ST s (DecodeAction s a))ConsumeFloat16Canonical (Float# -> ST s (DecodeAction s a))ConsumeFloatCanonical (Float# -> ST s (DecodeAction s a))ConsumeDoubleCanonical (Double# -> ST s (DecodeAction s a))ConsumeBytesCanonical (ByteString -> ST s (DecodeAction s a))ConsumeByteArrayCanonical (ByteArray -> ST s (DecodeAction s a))ConsumeStringCanonical (Text -> ST s (DecodeAction s a))ConsumeUtf8ByteArrayCanonical (ByteArray -> ST s (DecodeAction s a))ConsumeSimpleCanonical (Word# -> ST s (DecodeAction s a))Fail StringDone a
Given a Decoder, give us the DecodeAction
Read input tokens
Decode a Word.
Decode a Word8.
Decode a Word16.
Decode a Word32.
Decode a Word64.
Decode a negative Word.
Decode a negative Word64.
Decode an Int.
Decode an Int8.
Decode an Int16.
Decode an Int32.
Decode an Int64.
Decode an Integer.
Decode a Float.
Decode a Double.
Decode a string of bytes as a ByteString.
Decode a token marking the beginning of an indefinite length set of bytes.
Decode a textual string as a piece of Text.
Decode a token marking the beginning of an indefinite length string.
Decode the length of a list.
Decode a token marking the beginning of a list of indefinite length.
Decode the length of a map.
Decode a token marking the beginning of a map of indefinite length.
Decode an arbitrary tag and return it as a Word.
Decode an arbitrary 64-bit tag and return it as a Word64.
Decode a bool.
Decode a nullary value, and return a unit value.
Decode a simple CBOR value and give back a Word8. You
probably don't ever need to use this.
Specialised Read input token operations
Attempt to decode a word with decodeWord, and ensure the word is exactly as expected, or fail.
Attempt to decode a list length using decodeListLen, and ensure it is exactly the specified length, or fail.
Branching operations
Inspecting the token type
Peek at the current token we're about to decode, and return a TokenType specifying what it is.
Peek and return the length of the current buffer that we're running our decoder on.
The type of a token, which a decoder can ask for at an arbitrary time.
Instances5Bounded, Enum, Eq, Ord, Show
Bounded TokenTypeDefined in cborg-0.2.10.0 · Codec.CBOR.DecodingEnum TokenTypeDefined in cborg-0.2.10.0 · Codec.CBOR.DecodingEq TokenTypeDefined in cborg-0.2.10.0 · Codec.CBOR.DecodingOrd TokenTypeDefined in cborg-0.2.10.0 · Codec.CBOR.DecodingShow TokenTypeDefined in cborg-0.2.10.0 · Codec.CBOR.Decoding
Special operations
Sequence operations
2 declarationsDecode an indefinite sequence length.
Decode a sequence length.