Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Decoder s a
- toPlainDecoder ∷ Version → Decoder s a → Decoder s a
- fromPlainDecoder ∷ Decoder s a → Decoder s a
- withPlainDecoder ∷ Decoder s a → (Decoder s a → Decoder s b) → Decoder s b
- enforceDecoderVersion ∷ Version → Decoder s a → Decoder s a
- data DecoderError
- type ByteOffset = Int64
- data DecodeAction s a
- = 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 String
- | Done a
- data TokenType
- = TypeUInt
- | TypeUInt64
- | TypeNInt
- | TypeNInt64
- | TypeInteger
- | TypeFloat16
- | TypeFloat32
- | TypeFloat64
- | TypeBytes
- | TypeBytesIndef
- | TypeString
- | TypeStringIndef
- | TypeListLen
- | TypeListLen64
- | TypeListLenIndef
- | TypeMapLen
- | TypeMapLen64
- | TypeMapLenIndef
- | TypeTag
- | TypeTag64
- | TypeBool
- | TypeNull
- | TypeSimple
- | TypeBreak
- | TypeInvalid
- getDecoderVersion ∷ Decoder s Version
- ifDecoderVersionAtLeast ∷ Version → Decoder s a → Decoder s a → Decoder s a
- whenDecoderVersionAtLeast ∷ Version → Decoder s a → Decoder s ()
- unlessDecoderVersionAtLeast ∷ Version → Decoder s a → Decoder s ()
- cborError ∷ (MonadFail m, Buildable e) ⇒ e → m a
- toCborError ∷ (MonadFail m, Buildable e) ⇒ Either e a → m a
- showDecoderError ∷ Buildable e ⇒ e → String
- invalidKey ∷ MonadFail m ⇒ Word → m a
- assertTag ∷ Word → Decoder s ()
- enforceSize ∷ Text → Int → Decoder s ()
- matchSize ∷ Text → Int → Int → Decoder s ()
- binaryGetDecoder ∷ Bool → Text → Get a → Decoder s a
- allowTag ∷ Word → Decoder s ()
- decodeVersion ∷ Decoder s Version
- decodeRational ∷ Decoder s Rational
- decodeRationalWithTag ∷ Decoder s Rational
- decodeRecordNamed ∷ Text → (a → Int) → Decoder s a → Decoder s a
- decodeRecordNamedT ∷ (MonadTrans m, Monad (m (Decoder s))) ⇒ Text → (a → Int) → m (Decoder s) a → m (Decoder s) a
- decodeRecordSum ∷ Text → (Word → Decoder s (Int, a)) → Decoder s a
- decodeListLike ∷ Text → Decoder s a → (a → Int → Decoder s ()) → Decoder s a
- decodeListLikeT ∷ (MonadTrans m, Monad (m (Decoder s))) ⇒ Text → m (Decoder s) a → (a → Int → m (Decoder s) ()) → m (Decoder s) a
- decodeEnumBounded ∷ ∀ a s. (Enum a, Bounded a, Typeable a) ⇒ Decoder s a
- decodeWithOrigin ∷ Decoder s a → Decoder s (WithOrigin a)
- decodeMaybe ∷ Decoder s a → Decoder s (Maybe a)
- decodeNullMaybe ∷ Decoder s a → Decoder s (Maybe a)
- decodeStrictMaybe ∷ Decoder s a → Decoder s (StrictMaybe a)
- decodeNullStrictMaybe ∷ Decoder s a → Decoder s (StrictMaybe a)
- decodeEither ∷ Decoder s a → Decoder s b → Decoder s (Either a b)
- decodeList ∷ Decoder s a → Decoder s [a]
- decodeNonEmptyList ∷ Decoder s a → Decoder s (NonEmpty a)
- decodeVector ∷ Vector vec a ⇒ Decoder s a → Decoder s (vec a)
- decodeSet ∷ Ord a ⇒ Decoder s a → Decoder s (Set a)
- setTag ∷ Word
- decodeMap ∷ Ord k ⇒ Decoder s k → Decoder s v → Decoder s (Map k v)
- decodeMapByKey ∷ Ord k ⇒ Decoder s k → (k → Decoder s v) → Decoder s (Map k v)
- decodeMapLikeEnforceNoDuplicates ∷ Ord k ⇒ Decoder s (Maybe Int) → Decoder s (k, v) → Decoder s (Map k v)
- decodeVMap ∷ (Vector kv k, Vector vv v, Ord k) ⇒ Decoder s k → Decoder s v → Decoder s (VMap kv vv k v)
- decodeSeq ∷ Decoder s a → Decoder s (Seq a)
- decodeStrictSeq ∷ Decoder s a → Decoder s (StrictSeq a)
- decodeSetTag ∷ Decoder s ()
- decodeListLikeWithCount ∷ ∀ s a b. Monoid b ⇒ Decoder s (Maybe Int) → (a → b → b) → (b → Decoder s a) → Decoder s (Int, b)
- decodeSetLikeEnforceNoDuplicates ∷ ∀ s a b c. Monoid b ⇒ (a → b → b) → (b → (Int, c)) → Decoder s a → Decoder s c
- decodeListLikeEnforceNoDuplicates ∷ ∀ s a b c. Monoid b ⇒ Decoder s (Maybe Int) → (a → b → b) → (b → (Int, c)) → Decoder s a → Decoder s c
- decodeMapContents ∷ Decoder s a → Decoder s [a]
- decodeMapTraverse ∷ (Ord a, Applicative t) ⇒ Decoder s (t a) → Decoder s (t b) → Decoder s (t (Map a b))
- decodeMapContentsTraverse ∷ Applicative t ⇒ Decoder s (t a) → Decoder s (t b) → Decoder s (t [(a, b)])
- decodeUTCTime ∷ Decoder s UTCTime
- decodeIPv4 ∷ Decoder s IPv4
- decodeIPv6 ∷ Decoder s IPv6
- decodeBool ∷ Decoder s Bool
- decodeBreakOr ∷ Decoder s Bool
- decodeByteArray ∷ Decoder s ByteArray
- decodeByteArrayCanonical ∷ Decoder s ByteArray
- decodeBytes ∷ Decoder s ByteString
- decodeBytesCanonical ∷ Decoder s ByteString
- decodeBytesIndef ∷ Decoder s ()
- decodeDouble ∷ Decoder s Double
- decodeDoubleCanonical ∷ Decoder s Double
- decodeFloat ∷ Decoder s Float
- decodeFloat16Canonical ∷ Decoder s Float
- decodeFloatCanonical ∷ Decoder s Float
- decodeInt ∷ Decoder s Int
- decodeInt16 ∷ Decoder s Int16
- decodeInt16Canonical ∷ Decoder s Int16
- decodeInt32 ∷ Decoder s Int32
- decodeInt32Canonical ∷ Decoder s Int32
- decodeInt64 ∷ Decoder s Int64
- decodeInt64Canonical ∷ Decoder s Int64
- decodeInt8 ∷ Decoder s Int8
- decodeInt8Canonical ∷ Decoder s Int8
- decodeIntCanonical ∷ Decoder s Int
- decodeInteger ∷ Decoder s Integer
- decodeIntegerCanonical ∷ Decoder s Integer
- decodeNatural ∷ Decoder s Natural
- decodeListLen ∷ Decoder s Int
- decodeListLenCanonical ∷ Decoder s Int
- decodeListLenCanonicalOf ∷ Int → Decoder s ()
- decodeListLenIndef ∷ Decoder s ()
- decodeListLenOf ∷ Int → Decoder s ()
- decodeListLenOrIndef ∷ Decoder s (Maybe Int)
- decodeMapLen ∷ Decoder s Int
- decodeMapLenCanonical ∷ Decoder s Int
- decodeMapLenIndef ∷ Decoder s ()
- decodeMapLenOrIndef ∷ Decoder s (Maybe Int)
- decodeNegWord ∷ Decoder s Word
- decodeNegWord64 ∷ Decoder s Word64
- decodeNegWord64Canonical ∷ Decoder s Word64
- decodeNegWordCanonical ∷ Decoder s Word
- decodeNull ∷ Decoder s ()
- decodeSequenceLenIndef ∷ (r → a → r) → r → (r → b) → Decoder s a → Decoder s b
- decodeSequenceLenN ∷ (r → a → r) → r → (r → b) → Int → Decoder s a → Decoder s b
- decodeSimple ∷ Decoder s Word8
- decodeSimpleCanonical ∷ Decoder s Word8
- decodeString ∷ Decoder s Text
- decodeStringCanonical ∷ Decoder s Text
- decodeStringIndef ∷ Decoder s ()
- decodeTag ∷ Decoder s Word
- decodeTag64 ∷ Decoder s Word64
- decodeTag64Canonical ∷ Decoder s Word64
- decodeTagCanonical ∷ Decoder s Word
- decodeUtf8ByteArray ∷ Decoder s ByteArray
- decodeUtf8ByteArrayCanonical ∷ Decoder s ByteArray
- decodeWithByteSpan ∷ Decoder s a → Decoder s (a, ByteOffset, ByteOffset)
- decodeWord ∷ Decoder s Word
- decodeWord16 ∷ Decoder s Word16
- decodeWord16Canonical ∷ Decoder s Word16
- decodeWord32 ∷ Decoder s Word32
- decodeWord32Canonical ∷ Decoder s Word32
- decodeWord64 ∷ Decoder s Word64
- decodeWord64Canonical ∷ Decoder s Word64
- decodeWord8 ∷ Decoder s Word8
- decodeWord8Canonical ∷ Decoder s Word8
- decodeWordCanonical ∷ Decoder s Word
- decodeWordCanonicalOf ∷ Word → Decoder s ()
- decodeWordOf ∷ Word → Decoder s ()
- decodeTerm ∷ Decoder s Term
- peekAvailable ∷ Decoder s Int
- peekByteOffset ∷ Decoder s ByteOffset
- peekTokenType ∷ Decoder s TokenType
Decoders
toPlainDecoder ∷ Version → Decoder s a → Decoder s a Source #
Extract the underlying Decoder
by specifying the concrete version to be used.
fromPlainDecoder ∷ Decoder s a → Decoder s a Source #
Promote a regular Decoder
to a versioned one. Which means it will work for all
versions.
withPlainDecoder ∷ Decoder s a → (Decoder s a → Decoder s b) → Decoder s b Source #
Use the supplied decoder as a plain decoder with current version.
enforceDecoderVersion ∷ Version → Decoder s a → Decoder s a Source #
Ignore the current version of the decoder and enforce the supplied one instead.
data DecoderError Source #
DecoderErrorCanonicityViolation Text | |
DecoderErrorCustom Text Text | Custom decoding error, usually due to some validation failure |
DecoderErrorDeserialiseFailure Text DeserialiseFailure | |
DecoderErrorEmptyList Text | |
DecoderErrorLeftover Text ByteString | |
DecoderErrorSizeMismatch Text Int Int | A size mismatch |
DecoderErrorUnknownTag Text Word8 | |
DecoderErrorVoid |
Instances
Exception DecoderError | |
Show DecoderError | |
Defined in Cardano.Binary.FromCBOR | |
Buildable DecoderError | |
Defined in Cardano.Binary.FromCBOR build ∷ DecoderError → Builder Source # | |
Eq DecoderError | |
Defined in Cardano.Binary.FromCBOR (==) ∷ DecoderError → DecoderError → Bool Source # (/=) ∷ DecoderError → DecoderError → Bool Source # |
type ByteOffset = Int64 Source #
data DecodeAction s a Source #
An action, representing a step for a decoder to taken and a continuation to invoke with the expected value.
Since: cborg-0.2.0.0
The type of a token, which a decoder can ask for at an arbitrary time.
Since: cborg-0.2.0.0
Instances
Bounded TokenType | |
Enum TokenType | |
Defined in Codec.CBOR.Decoding succ ∷ TokenType → TokenType Source # pred ∷ TokenType → TokenType Source # toEnum ∷ Int → TokenType Source # fromEnum ∷ TokenType → Int Source # enumFrom ∷ TokenType → [TokenType] Source # enumFromThen ∷ TokenType → TokenType → [TokenType] Source # enumFromTo ∷ TokenType → TokenType → [TokenType] Source # enumFromThenTo ∷ TokenType → TokenType → TokenType → [TokenType] Source # | |
Show TokenType | |
Eq TokenType | |
Ord TokenType | |
Defined in Codec.CBOR.Decoding |
Versioning
getDecoderVersion ∷ Decoder s Version Source #
Extract current version of the decoder
>>>
import Cardano.Ledger.Decoding
>>>
decodeFullDecoder 3 "Version" getDecoderVersion ""
Right 3
ifDecoderVersionAtLeast Source #
∷ Version | |
→ Decoder s a | Use this decoder if current decoder version is larger or equal to the supplied
|
→ Decoder s a | Use this decoder if current decoder version is lower than the supplied |
→ Decoder s a |
Conditionally choose the newer or older decoder, depending on the current version. Version in the context of encoders/decoders is the major protocol version. Supplied version acts as a pivot.
Example
Let's say prior to the version 2 some type Foo
was backed by Word16
, but at the 2nd
version onwards it was switched to Word32
instead. In order to support both versions,
we change the type, but we also use this condition to keep backwards compatibility of
the decoder:
>>>
newtype Foo = Foo Word32
>>>
decFoo = Foo <$> ifDecoderVersionAtLeast 2 decodeWord32 (fromIntegral <$> decodeWord16)
whenDecoderVersionAtLeast Source #
∷ Version | |
→ Decoder s a | Run this decoder whenever current decoder version is larger or equal to the supplied
|
→ Decoder s () |
Optionally run a decoder depending on the current version and the supplied one.
unlessDecoderVersionAtLeast Source #
∷ Version | |
→ Decoder s a | Run this decoder whenever current decoder version is smaller to the supplied |
→ Decoder s () |
Optionally run a decoder depending on the current version and the supplied one.
Error reporting
showDecoderError ∷ Buildable e ⇒ e → String Source #
invalidKey ∷ MonadFail m ⇒ Word → m a Source #
Report an error when a numeric key of the type constructor doesn't match.
enforceSize ∷ Text → Int → Decoder s () Source #
Enforces that the input size is the same as the decoded one, failing in case it's not
matchSize ∷ Text → Int → Int → Decoder s () Source #
Compare two sizes, failing if they are not equal
Compatibility tools
Custom decoders
decodeRationalWithTag ∷ Decoder s Rational Source #
Enforces tag 30 to indicate a rational number, as per tag assignment: https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml
decodeRecordNamedT ∷ (MonadTrans m, Monad (m (Decoder s))) ⇒ Text → (a → Int) → m (Decoder s) a → m (Decoder s) a Source #
∷ Text | Name for error reporting |
→ Decoder s a | Decoder for the datastructure itself |
→ (a → Int → Decoder s ()) | In case when length was encoded, act upon it. |
→ Decoder s a |
Use this decoder for any list like structure that accepts fixed or variable list length encoding.
decodeWithOrigin ∷ Decoder s a → Decoder s (WithOrigin a) Source #
Containers
decodeNullMaybe ∷ Decoder s a → Decoder s (Maybe a) Source #
Alternative way to decode a Maybe type.
Note - this is not the default method for decoding Maybe
, use decodeMaybe
instead.
decodeStrictMaybe ∷ Decoder s a → Decoder s (StrictMaybe a) Source #
Unlike decodeMaybe
this allows variable as well as exact list length encoding for
all versions, because Byron never used StrictMaybe
type.
decodeNullStrictMaybe ∷ Decoder s a → Decoder s (StrictMaybe a) Source #
Alternative way to decode a StrictMaybe
type.
Note - this is not the default method for decoding StrictMaybe
, use
decodeStrictMaybe
instead.
decodeList ∷ Decoder s a → Decoder s [a] Source #
for list.Decoder
- [>= 2] - Allows variable as well as exact list length encoding.
- [< 2] - Expects variable list length encoding
decodeVector ∷ Vector vec a ⇒ Decoder s a → Decoder s (vec a) Source #
Generic decoder for vectors. Its intended use is to allow easy
definition of Serialise
instances for custom vector
decodeSet ∷ Ord a ⇒ Decoder s a → Decoder s (Set a) Source #
Decoder
for Set
. Versions variance:
- [>= 9] - Allows variable as well as exact list length encoding. Duplicates are not allowed. Set tag 258 is permitted, but not enforced.
- [>= 2, < 9] - Allows variable as well as exact list length encoding. Duplicates are silently ignored, set tag 258 is not permitted.
- [< 2] - Expects exact list length encoding and enforces strict order without any duplicates. Also enforces special set tag 258, which was abandoned starting with version 2
We stitch a `258` in from of a (Hash)Set, so that tools which programmatically check for canonicity can recognise it from a normal array. Why 258? This will be formalised pretty soon, but IANA allocated 256...18446744073709551615 to "First come, first served": https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml Currently `258` is the first unassigned tag and as it requires 2 bytes to be encoded, it sounds like the best fit.
https://github.com/input-output-hk/cbor-sets-spec/blob/master/CBOR_SETS.md
decodeMap ∷ Ord k ⇒ Decoder s k → Decoder s v → Decoder s (Map k v) Source #
Decoder
for Map
. Versions variance:
- [>= 9] - Allows variable as well as exact list length encoding. Duplicate keys will result in a deserialization failure
- [>= 2] - Allows variable as well as exact list length encoding. Duplicate keys are silently ignored
- [< 2] - Expects exact list length encoding and enforces strict order without any duplicates.
An example of how to use versioning
>>>
:set -XOverloadedStrings
>>>
import Codec.CBOR.FlatTerm
>>>
fromFlatTerm (toPlainDecoder 1 (decodeMap decodeInt decodeBytes)) [TkMapLen 2,TkInt 1,TkBytes "Foo",TkInt 2,TkBytes "Bar"]
Right (fromList [(1,"Foo"),(2,"Bar")])>>>
fromFlatTerm (toPlainDecoder 1 (decodeMap decodeInt decodeBytes)) [TkMapBegin,TkInt 1,TkBytes "Foo",TkInt 2,TkBytes "Bar"]
Left "decodeMapLen: unexpected token TkMapBegin">>>
fromFlatTerm (toPlainDecoder 2 (decodeMap decodeInt decodeBytes)) [TkMapBegin,TkInt 1,TkBytes "Foo",TkInt 2,TkBytes "Bar",TkBreak]
Right (fromList [(1,"Foo"),(2,"Bar")])
decodeMapByKey ∷ Ord k ⇒ Decoder s k → (k → Decoder s v) → Decoder s (Map k v) Source #
Just like decodeMap
, but also gives access to the key for the value decoder.
decodeMapLikeEnforceNoDuplicates ∷ Ord k ⇒ Decoder s (Maybe Int) → Decoder s (k, v) → Decoder s (Map k v) Source #
Similar to decodeMapByKey
, except it gives access to the key value
decoder as a pair and allows for different type of length encoding
decodeVMap ∷ (Vector kv k, Vector vv v, Ord k) ⇒ Decoder s k → Decoder s v → Decoder s (VMap kv vv k v) Source #
Decode VMap
. Unlike decodeMap
it does not behavee differently for
version prior to 2.
decodeSeq ∷ Decoder s a → Decoder s (Seq a) Source #
Decoder for Seq
. Same behavior for all versions, allows variable as
well as exact list length encoding
decodeStrictSeq ∷ Decoder s a → Decoder s (StrictSeq a) Source #
Decoder for StrictSeq
. Same behavior for all versions, allows variable as
well as exact list length encoding.
decodeSetTag ∷ Decoder s () Source #
decodeListLikeWithCount Source #
∷ ∀ s a b. Monoid b | |
⇒ Decoder s (Maybe Int) | Length decoder that produces the expected number of elements. When |
→ (a → b → b) | Add an element into the decoded List like data structure |
→ (b → Decoder s a) | Decoder for the values. Current accumulator is supplied as an argument |
→ Decoder s (Int, b) |
Decode a collection of values with ability to supply length decoder. Number of decoded elements will be returned together with the data structure
decodeSetLikeEnforceNoDuplicates Source #
∷ ∀ s a b c. Monoid b | |
⇒ (a → b → b) | Add an element into the decoded Set like data structure |
→ (b → (Int, c)) | Get the final data structure from the decoded sequence of values and the number of
elements it contains. This is useful when a sequence on the wire is represented by a
|
→ Decoder s a | |
→ Decoder s c |
Decode a Set as a either a definite or indefinite list. Duplicates are not allowed. Set tag 258 is permitted, but not enforced.
decodeListLikeEnforceNoDuplicates Source #
∷ ∀ s a b c. Monoid b | |
⇒ Decoder s (Maybe Int) | |
→ (a → b → b) | Add an element into the decoded List like data structure |
→ (b → (Int, c)) | Get the final data structure and the number of elements it has. |
→ Decoder s a | |
→ Decoder s c |
Decode a collection of values with ability to supply length decoder. Duplicates are not allowed.
decodeMapContents ∷ Decoder s a → Decoder s [a] Source #
Applicaitve
decodeMapTraverse ∷ (Ord a, Applicative t) ⇒ Decoder s (t a) → Decoder s (t b) → Decoder s (t (Map a b)) Source #
decodeMapContentsTraverse ∷ Applicative t ⇒ Decoder s (t a) → Decoder s (t b) → Decoder s (t [(a, b)]) Source #
Time
Network
decodeIPv4 ∷ Decoder s IPv4 Source #
decodeIPv6 ∷ Decoder s IPv6 Source #
Lifted cborg
decoders
decodeBool ∷ Decoder s Bool Source #
decodeBreakOr ∷ Decoder s Bool Source #
decodeBytesIndef ∷ Decoder s () Source #
decodeDouble ∷ Decoder s Double Source #
decodeFloat ∷ Decoder s Float Source #
decodeInt16 ∷ Decoder s Int16 Source #
decodeInt32 ∷ Decoder s Int32 Source #
decodeInt64 ∷ Decoder s Int64 Source #
decodeInt8 ∷ Decoder s Int8 Source #
decodeListLen ∷ Decoder s Int Source #
decodeListLenCanonicalOf ∷ Int → Decoder s () Source #
decodeListLenIndef ∷ Decoder s () Source #
decodeListLenOf ∷ Int → Decoder s () Source #
decodeMapLen ∷ Decoder s Int Source #
decodeMapLenIndef ∷ Decoder s () Source #
decodeNegWord ∷ Decoder s Word Source #
decodeNull ∷ Decoder s () Source #
decodeSequenceLenIndef ∷ (r → a → r) → r → (r → b) → Decoder s a → Decoder s b Source #
decodeSimple ∷ Decoder s Word8 Source #
decodeString ∷ Decoder s Text Source #
decodeStringIndef ∷ Decoder s () Source #
decodeTag64 ∷ Decoder s Word64 Source #
decodeWithByteSpan ∷ Decoder s a → Decoder s (a, ByteOffset, ByteOffset) Source #
decodeWord ∷ Decoder s Word Source #
decodeWord16 ∷ Decoder s Word16 Source #
decodeWord32 ∷ Decoder s Word32 Source #
decodeWord64 ∷ Decoder s Word64 Source #
decodeWord8 ∷ Decoder s Word8 Source #
decodeWordCanonicalOf ∷ Word → Decoder s () Source #
decodeWordOf ∷ Word → Decoder s () Source #
decodeTerm ∷ Decoder s Term Source #
peekAvailable ∷ Decoder s Int Source #