| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Ledger.Binary.Encoding
Synopsis
- serialize ∷ EncCBOR a ⇒ Version → a → ByteString
- serialize' ∷ EncCBOR a ⇒ Version → a → ByteString
- serializeBuilder ∷ EncCBOR a ⇒ Version → a → Builder
- hashWithEncoder ∷ HashAlgorithm h ⇒ Version → (a → Encoding) → a → Hash h a
- hashEncCBOR ∷ (HashAlgorithm h, EncCBOR a) ⇒ Version → a → Hash h a
- module Cardano.Ledger.Binary.Version
- data Tokens
- = TkWord !Word Tokens
- | TkWord64 !Word64 Tokens
- | TkInt !Int Tokens
- | TkInt64 !Int64 Tokens
- | TkBytes !ByteString Tokens
- | TkBytesBegin Tokens
- | TkByteArray !SlicedByteArray Tokens
- | TkString !Text Tokens
- | TkUtf8ByteArray !SlicedByteArray Tokens
- | TkStringBegin Tokens
- | TkListLen !Word Tokens
- | TkListBegin Tokens
- | TkMapLen !Word Tokens
- | TkMapBegin Tokens
- | TkTag !Word Tokens
- | TkTag64 !Word64 Tokens
- | TkInteger !Integer Tokens
- | TkNull Tokens
- | TkUndef Tokens
- | TkBool !Bool Tokens
- | TkSimple !Word8 Tokens
- | TkFloat16 !Float Tokens
- | TkFloat32 !Float Tokens
- | TkFloat64 !Double Tokens
- | TkBreak Tokens
- | TkEncoded !ByteString Tokens
- | TkEnd
- data Encoding
- encodeFloat ∷ Float → Encoding
- encodeWord ∷ Word → Encoding
- encodeWord8 ∷ Word8 → Encoding
- encodeWord16 ∷ Word16 → Encoding
- encodeWord32 ∷ Word32 → Encoding
- encodeWord64 ∷ Word64 → Encoding
- encodeInt ∷ Int → Encoding
- encodeInt8 ∷ Int8 → Encoding
- encodeInt16 ∷ Int16 → Encoding
- encodeInt32 ∷ Int32 → Encoding
- encodeInt64 ∷ Int64 → Encoding
- encodeInteger ∷ Integer → Encoding
- encodeBytes ∷ ByteString → Encoding
- encodeByteArray ∷ SlicedByteArray → Encoding
- encodeBytesIndef ∷ Encoding
- encodeString ∷ Text → Encoding
- encodeStringIndef ∷ Encoding
- encodeUtf8ByteArray ∷ SlicedByteArray → Encoding
- encodeListLen ∷ Word → Encoding
- encodeListLenIndef ∷ Encoding
- encodeMapLen ∷ Word → Encoding
- encodeMapLenIndef ∷ Encoding
- encodeBreak ∷ Encoding
- encodeTag ∷ Word → Encoding
- encodeTag64 ∷ Word64 → Encoding
- encodeBool ∷ Bool → Encoding
- encodeUndef ∷ Encoding
- encodeNull ∷ Encoding
- encodeSimple ∷ Word8 → Encoding
- encodeFloat16 ∷ Float → Encoding
- encodeDouble ∷ Double → Encoding
- encodePreEncoded ∷ ByteString → Encoding
- encodeSeq ∷ (a → Encoding) → Seq a → Encoding
- encodeMaybe ∷ (a → Encoding) → Maybe a → Encoding
- encodeNullMaybe ∷ (a → Encoding) → Maybe a → Encoding
- class KnownNat (FixedSize a) ⇒ FixedSizeCodec a where
- type FixedSize a ∷ Nat
- rawEncodeFixedSized ∷ a → ByteString
- rawDecodeFixedSized ∷ MonadFail m ⇒ ByteString → m a
- type family FixedSize a ∷ Nat
- encodeFixedSized ∷ FixedSizeCodec a ⇒ a → Encoding
- variableListLenEncoding ∷ Int → Encoding → Encoding
- encodeVector ∷ Vector v a ⇒ (a → Encoding) → v a → Encoding
- toBuilder ∷ Version → Encoding → Builder
- encodeTerm ∷ Term → Encoding
- encodeList ∷ (a → Encoding) → [a] → Encoding
- encodeSet ∷ (a → Encoding) → Set a → Encoding
- encodeMap ∷ (k → Encoding) → (v → Encoding) → Map k v → Encoding
- encodeEnum ∷ Enum a ⇒ a → Encoding
- encodeRatioWithTag ∷ (t → Encoding) → Ratio t → Encoding
- toPlainEncoding ∷ Version → Encoding → Encoding
- fromPlainEncoding ∷ Encoding → Encoding
- fromPlainEncodingWithVersion ∷ (Version → Encoding) → Encoding
- withCurrentEncodingVersion ∷ (Version → Encoding) → Encoding
- enforceEncodingVersion ∷ Version → Encoding → Encoding
- ifEncodingVersionAtLeast ∷ Version → Encoding → Encoding → Encoding
- encodeVersion ∷ Version → Encoding
- encodeStrictMaybe ∷ (a → Encoding) → StrictMaybe a → Encoding
- encodeNullStrictMaybe ∷ (a → Encoding) → StrictMaybe a → Encoding
- encodeTuple ∷ (a → Encoding) → (b → Encoding) → (a, b) → Encoding
- encodeRatio ∷ (t → Encoding) → Ratio t → Encoding
- encodeRatioNoTag ∷ (t → Encoding) → Ratio t → Encoding
- encodeWithOrigin ∷ (a → Encoding) → WithOrigin a → Encoding
- encodeStrictSeq ∷ (a → Encoding) → StrictSeq a → Encoding
- encodeVMap ∷ ∀ (kv ∷ Type → Type) k (vv ∷ Type → Type) v. (Vector kv k, Vector vv v) ⇒ (k → Encoding) → (v → Encoding) → VMap kv vv k v → Encoding
- encodeFoldableEncoder ∷ Foldable f ⇒ (a → Encoding) → f a → Encoding
- encodeFoldableAsDefLenList ∷ Foldable f ⇒ (a → Encoding) → f a → Encoding
- encodeFoldableAsIndefLenList ∷ Foldable f ⇒ (a → Encoding) → f a → Encoding
- encodeFoldableMapEncoder ∷ Foldable f ⇒ (Word → a → Maybe Encoding) → f a → Encoding
- lengthThreshold ∷ Int
- encodeUTCTime ∷ UTCTime → Encoding
- encodeIPv4 ∷ IPv4 → Encoding
- ipv4ToBytes ∷ IPv4 → ByteString
- encodeIPv6 ∷ IPv6 → Encoding
- ipv6ToBytes ∷ IPv6 → ByteString
- class EncCBOR a where
- newtype PreEncoded = PreEncoded {}
- toByronCBOR ∷ EncCBOR a ⇒ a → Encoding
- encodeNestedCbor ∷ EncCBOR a ⇒ a → Encoding
- encodeNestedCborBytes ∷ ByteString → Encoding
- runByteBuilder ∷ Int → Builder → ByteString
- encodeMemPack ∷ MemPack a ⇒ a → Encoding
Running decoders
serialize ∷ EncCBOR a ⇒ Version → a → ByteString Source #
Serialize a Haskell value with a EncCBOR instance to an external binary
representation.
The output is represented as a lazy ByteString and is constructed
incrementally.
serialize' ∷ EncCBOR a ⇒ Version → a → ByteString Source #
Serialize a Haskell value to an external binary representation.
The output is represented as a strict ByteString.
serializeBuilder ∷ EncCBOR a ⇒ Version → a → Builder Source #
Serialize into a Builder. Useful if you want to throw other ByteStrings around it.
Hash
hashWithEncoder ∷ HashAlgorithm h ⇒ Version → (a → Encoding) → a → Hash h a Source #
hashEncCBOR ∷ (HashAlgorithm h, EncCBOR a) ⇒ Version → a → Hash h a Source #
A flattened representation of a term, which is independent of any underlying binary representation, but which we later serialise into CBOR format.
Since: cborg-0.2.0.0
Constructors
encodeFloat ∷ Float → Encoding Source #
encodeWord ∷ Word → Encoding Source #
encodeWord8 ∷ Word8 → Encoding Source #
encodeInt8 ∷ Int8 → Encoding Source #
encodeInt16 ∷ Int16 → Encoding Source #
encodeInt32 ∷ Int32 → Encoding Source #
encodeInt64 ∷ Int64 → Encoding Source #
encodeString ∷ Text → Encoding Source #
encodeListLen ∷ Word → Encoding Source #
encodeMapLen ∷ Word → Encoding Source #
encodeTag64 ∷ Word64 → Encoding Source #
encodeBool ∷ Bool → Encoding Source #
encodeSimple ∷ Word8 → Encoding Source #
encodeSeq ∷ (a → Encoding) → Seq a → Encoding Source #
Encode a Seq. Variable length encoding for Sequences larger than 23 elements, otherwise exact length encoding
encodeNullMaybe ∷ (a → Encoding) → Maybe a → Encoding Source #
Alternative way to encode a Maybe type.
Note - this is not the default method for encoding Maybe, use encodeMaybe instead
class KnownNat (FixedSize a) ⇒ FixedSizeCodec a where Source #
Methods
rawEncodeFixedSized ∷ a → ByteString Source #
rawDecodeFixedSized ∷ MonadFail m ⇒ ByteString → m a Source #
Instances
type family FixedSize a ∷ Nat Source #
Instances
| type FixedSize MessageHash | |
Defined in Cardano.Crypto.DSIGN.EcdsaSecp256k1 | |
| type FixedSize Proof | |
Defined in Cardano.Crypto.VRF.Praos | |
| type FixedSize SignKey | |
Defined in Cardano.Crypto.VRF.Praos | |
| type FixedSize VerKey | |
Defined in Cardano.Crypto.VRF.Praos | |
| type FixedSize Proof | |
Defined in Cardano.Crypto.VRF.PraosBatchCompat | |
| type FixedSize SignKey | |
Defined in Cardano.Crypto.VRF.PraosBatchCompat | |
| type FixedSize VerKey | |
Defined in Cardano.Crypto.VRF.PraosBatchCompat | |
| type FixedSize (PossessionProofDSIGN (BLS12381DSIGN curve)) | |
Defined in Cardano.Crypto.DSIGN.BLS12381.Internal type FixedSize (PossessionProofDSIGN (BLS12381DSIGN curve)) = PossessionProofSizeDSIGN (BLS12381DSIGN curve) | |
| type FixedSize (SigDSIGN (BLS12381DSIGN curve)) | |
Defined in Cardano.Crypto.DSIGN.BLS12381.Internal | |
| type FixedSize (SigDSIGN EcdsaSecp256k1DSIGN) | |
| type FixedSize (SigDSIGN Ed25519DSIGN) | |
Defined in Cardano.Crypto.DSIGN.Ed25519 | |
| type FixedSize (SigDSIGN Ed448DSIGN) | |
Defined in Cardano.Crypto.DSIGN.Ed448 | |
| type FixedSize (SigDSIGN MockDSIGN) | |
| type FixedSize (SigDSIGN NeverDSIGN) | |
Defined in Cardano.Crypto.DSIGN.NeverUsed | |
| type FixedSize (SigDSIGN SchnorrSecp256k1DSIGN) | |
| type FixedSize (SignKeyDSIGN (BLS12381DSIGN curve)) | |
Defined in Cardano.Crypto.DSIGN.BLS12381.Internal | |
| type FixedSize (SignKeyDSIGN EcdsaSecp256k1DSIGN) | |
| type FixedSize (SignKeyDSIGN Ed25519DSIGN) | |
Defined in Cardano.Crypto.DSIGN.Ed25519 | |
| type FixedSize (SignKeyDSIGN Ed448DSIGN) | |
Defined in Cardano.Crypto.DSIGN.Ed448 | |
| type FixedSize (SignKeyDSIGN MockDSIGN) | |
Defined in Cardano.Crypto.DSIGN.Mock | |
| type FixedSize (SignKeyDSIGN NeverDSIGN) | |
Defined in Cardano.Crypto.DSIGN.NeverUsed | |
| type FixedSize (SignKeyDSIGN SchnorrSecp256k1DSIGN) | |
| type FixedSize (VerKeyDSIGN (BLS12381DSIGN curve)) | |
Defined in Cardano.Crypto.DSIGN.BLS12381.Internal | |
| type FixedSize (VerKeyDSIGN EcdsaSecp256k1DSIGN) | |
| type FixedSize (VerKeyDSIGN Ed25519DSIGN) | |
Defined in Cardano.Crypto.DSIGN.Ed25519 | |
| type FixedSize (VerKeyDSIGN Ed448DSIGN) | |
Defined in Cardano.Crypto.DSIGN.Ed448 | |
| type FixedSize (VerKeyDSIGN MockDSIGN) | |
Defined in Cardano.Crypto.DSIGN.Mock | |
| type FixedSize (VerKeyDSIGN NeverDSIGN) | |
Defined in Cardano.Crypto.DSIGN.NeverUsed | |
| type FixedSize (VerKeyDSIGN SchnorrSecp256k1DSIGN) | |
| type FixedSize (SigKES (CompactSingleKES d)) | |
Defined in Cardano.Crypto.KES.CompactSingle | |
| type FixedSize (SigKES (CompactSumKES h d)) | |
Defined in Cardano.Crypto.KES.CompactSum | |
| type FixedSize (SigKES (MockKES t)) | |
Defined in Cardano.Crypto.KES.Mock | |
| type FixedSize (SigKES NeverKES) | |
Defined in Cardano.Crypto.KES.NeverUsed | |
| type FixedSize (SigKES (SimpleKES d t)) | |
Defined in Cardano.Crypto.KES.Simple | |
| type FixedSize (SigKES (SingleKES d)) | |
| type FixedSize (SigKES (SumKES h d)) | |
Defined in Cardano.Crypto.KES.Sum | |
| type FixedSize (SignKeyKES (MockKES t)) | |
Defined in Cardano.Crypto.KES.Mock | |
| type FixedSize (UnsoundPureSignKeyKES (CompactSingleKES d)) | |
Defined in Cardano.Crypto.KES.CompactSingle | |
| type FixedSize (UnsoundPureSignKeyKES (CompactSumKES h d)) | |
Defined in Cardano.Crypto.KES.CompactSum | |
| type FixedSize (UnsoundPureSignKeyKES (MockKES t)) | |
Defined in Cardano.Crypto.KES.Mock | |
| type FixedSize (UnsoundPureSignKeyKES NeverKES) | |
Defined in Cardano.Crypto.KES.NeverUsed | |
| type FixedSize (UnsoundPureSignKeyKES (SimpleKES d t)) | |
Defined in Cardano.Crypto.KES.Simple | |
| type FixedSize (UnsoundPureSignKeyKES (SingleKES d)) | |
Defined in Cardano.Crypto.KES.Single | |
| type FixedSize (UnsoundPureSignKeyKES (SumKES h d)) | |
Defined in Cardano.Crypto.KES.Sum | |
| type FixedSize (VerKeyKES (CompactSingleKES d)) | |
Defined in Cardano.Crypto.KES.CompactSingle | |
| type FixedSize (VerKeyKES (CompactSumKES h d)) | |
Defined in Cardano.Crypto.KES.CompactSum | |
| type FixedSize (VerKeyKES (MockKES t)) | |
Defined in Cardano.Crypto.KES.Mock | |
| type FixedSize (VerKeyKES NeverKES) | |
Defined in Cardano.Crypto.KES.NeverUsed | |
| type FixedSize (VerKeyKES (SimpleKES d t)) | |
Defined in Cardano.Crypto.KES.Simple | |
| type FixedSize (VerKeyKES (SingleKES d)) | |
Defined in Cardano.Crypto.KES.Single | |
| type FixedSize (VerKeyKES (SumKES h d)) | |
Defined in Cardano.Crypto.KES.Sum | |
| type FixedSize (PackedBytes n) | |
Defined in Cardano.Crypto.PackedBytes.Internal | |
| type FixedSize (PinnedSizedBytes n) | |
Defined in Cardano.Crypto.PinnedSizedBytes | |
| type FixedSize (CertVRF MockVRF) | |
Defined in Cardano.Crypto.VRF.Mock | |
| type FixedSize (CertVRF NeverVRF) | |
Defined in Cardano.Crypto.VRF.NeverUsed | |
| type FixedSize (CertVRF SimpleVRF) | |
Defined in Cardano.Crypto.VRF.Simple | |
| type FixedSize (CertVRF PraosVRF) | |
| type FixedSize (CertVRF PraosBatchCompatVRF) | |
Defined in Cardano.Crypto.VRF.PraosBatchCompat | |
| type FixedSize (SignKeyVRF MockVRF) | |
Defined in Cardano.Crypto.VRF.Mock | |
| type FixedSize (SignKeyVRF NeverVRF) | |
Defined in Cardano.Crypto.VRF.NeverUsed | |
| type FixedSize (SignKeyVRF SimpleVRF) | |
Defined in Cardano.Crypto.VRF.Simple | |
| type FixedSize (SignKeyVRF PraosVRF) | |
Defined in Cardano.Crypto.VRF.Praos | |
| type FixedSize (SignKeyVRF PraosBatchCompatVRF) | |
Defined in Cardano.Crypto.VRF.PraosBatchCompat | |
| type FixedSize (VerKeyVRF MockVRF) | |
Defined in Cardano.Crypto.VRF.Mock | |
| type FixedSize (VerKeyVRF NeverVRF) | |
Defined in Cardano.Crypto.VRF.NeverUsed | |
| type FixedSize (VerKeyVRF SimpleVRF) | |
Defined in Cardano.Crypto.VRF.Simple | |
| type FixedSize (VerKeyVRF PraosVRF) | |
| type FixedSize (VerKeyVRF PraosBatchCompatVRF) | |
Defined in Cardano.Crypto.VRF.PraosBatchCompat | |
| type FixedSize (SignedDSIGN v a) | |
Defined in Cardano.Crypto.DSIGN.Class | |
| type FixedSize (SignedKES v a) | |
Defined in Cardano.Crypto.KES.Class | |
encodeFixedSized ∷ FixedSizeCodec a ⇒ a → Encoding Source #
variableListLenEncoding Source #
Arguments
| ∷ Int | Number of elements in the encoded data structure. |
| → Encoding | Encoding for the actual data structure |
| → Encoding |
Conditionally use variable length encoding for list like structures with length larger than 23, otherwise use exact list length encoding.
encodeVector ∷ Vector v a ⇒ (a → Encoding) → v a → Encoding Source #
Generic encoder for vectors. Its intended use is to allow easy
definition of EncCBOR instances for custom vector
encodeTerm ∷ Term → Encoding Source #
encodeList ∷ (a → Encoding) → [a] → Encoding Source #
Encode a list. Versions variance:
- [>= 2] - Variable length encoding for lists longer than 23 elements, otherwise exact length encoding
- [< 2] - Variable length encoding
encodeSet ∷ (a → Encoding) → Set a → Encoding Source #
Encode a Set. Versions variance:
- [>= 9] - Variable length encoding for Sets larger than 23 elements, otherwise exact
length encoding. Prefixes with a special 258
setTag. - [>= 2] - Variable length encoding for Sets larger than 23 elements, otherwise exact length encoding
- [< 2] - Variable length encoding. Prefixes with a special 258
setTag.
encodeMap ∷ (k → Encoding) → (v → Encoding) → Map k v → Encoding Source #
Encode a Map. Versions variance:
- [>= 2] - Variable length encoding for Maps larger than 23 key value pairs, otherwise exact length encoding
- [< 2] - Variable length encoding.
encodeEnum ∷ Enum a ⇒ a → Encoding Source #
encodeRatioWithTag ∷ (t → Encoding) → Ratio t → Encoding Source #
Encode a rational number with tag 30, as per tag assignment: https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml
withCurrentEncodingVersion ∷ (Version → Encoding) → Encoding Source #
Get access to the current version being used in the encoder
enforceEncodingVersion ∷ Version → Encoding → Encoding Source #
Ignore the current version of the encoder and enforce the supplied one instead.
ifEncodingVersionAtLeast Source #
Arguments
| ∷ Version | |
| → Encoding | Use this encoder if current encoder version is larger or equal to the supplied
|
| → Encoding | Use this encoder if current encoder version is lower than the supplied |
| → Encoding |
Conditionally choose the newer or older encoder, depending on the current version. Supplied version acts as a pivot.
Example
encodeStrictMaybe ∷ (a → Encoding) → StrictMaybe a → Encoding Source #
encodeNullStrictMaybe ∷ (a → Encoding) → StrictMaybe a → Encoding Source #
Alternative way to encode a Maybe type.
Note - this is not the default method for encoding StrictMaybe, use
encodeStrictMaybe instead
encodeWithOrigin ∷ (a → Encoding) → WithOrigin a → Encoding Source #
encodeVMap ∷ ∀ (kv ∷ Type → Type) k (vv ∷ Type → Type) v. (Vector kv k, Vector vv v) ⇒ (k → Encoding) → (v → Encoding) → VMap kv vv k v → Encoding Source #
Mimics Map encoder encodeMap identically.
encodeFoldableEncoder ∷ Foldable f ⇒ (a → Encoding) → f a → Encoding Source #
Encode any Foldable with the variable list length encoding, which will use indefinite encoding over 23 elements and definite otherwise.
encodeFoldableAsIndefLenList ∷ Foldable f ⇒ (a → Encoding) → f a → Encoding Source #
Encode any Foldable with indefinite list length encoding
encodeFoldableMapEncoder Source #
Arguments
| ∷ Foldable f | |
| ⇒ (Word → a → Maybe Encoding) | A function that accepts an index of the value in the foldable data strucure, the actual value and optionally produces the encoding of the value and an index if that value should be encoded. |
| → f a | |
| → Encoding |
Encode a data structure as a Map with the 0-based index for a Key to a value. Uses variable map length encoding, which means an indefinite encoding for maps with over 23 elements and definite otherwise.
lengthThreshold ∷ Int Source #
This is the optimal maximum number for encoding exact length. Above that threashold using variable length encoding will result in less bytes on the wire.
encodeIPv4 ∷ IPv4 → Encoding Source #
ipv4ToBytes ∷ IPv4 → ByteString Source #
encodeIPv6 ∷ IPv6 → Encoding Source #
ipv6ToBytes ∷ IPv6 → ByteString Source #
class EncCBOR a where Source #
Minimal complete definition
Nothing
Instances
| EncCBOR ByteArray Source # | |
| EncCBOR ByteString Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ ByteString → Encoding Source # | |
| EncCBOR ByteString Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ ByteString → Encoding Source # | |
| EncCBOR ShortByteString Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods | |
| EncCBOR IPv4 Source # | |
| EncCBOR IPv6 Source # | |
| EncCBOR BitField Source # | |
| EncCBOR LeiosCert Source # | |
| EncCBOR Proof Source # | |
| EncCBOR SignKey Source # | |
| EncCBOR VerKey Source # | |
| EncCBOR PreEncoded Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ PreEncoded → Encoding Source # | |
| EncCBOR Encoding Source # | |
| EncCBOR Version Source # | |
| EncCBOR BlockNo Source # | |
| EncCBOR EpochInterval Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods | |
| EncCBOR EpochNo Source # | |
| EncCBOR EpochSize Source # | |
| EncCBOR SlotNo Source # | |
| EncCBOR SystemStart Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods | |
| EncCBOR ByteArray Source # | |
| EncCBOR SlicedByteArray Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods | |
| EncCBOR Encoding Source # | |
| EncCBOR Term Source # | |
| EncCBOR Void Source # | |
| EncCBOR Int16 Source # | |
| EncCBOR Int32 Source # | |
| EncCBOR Int64 Source # | |
| EncCBOR Int8 Source # | |
| EncCBOR Word16 Source # | |
| EncCBOR Word32 Source # | |
| EncCBOR Word64 Source # | |
| EncCBOR Word8 Source # | |
| EncCBOR Data Source # | |
| EncCBOR ScriptContext Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods | |
| EncCBOR ScriptContext Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods | |
| EncCBOR ScriptContext Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods | |
| EncCBOR Text Source # | |
| EncCBOR UTCTime Source # | |
| EncCBOR Integer Source # | |
| EncCBOR Natural Source # | |
| EncCBOR () Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| EncCBOR Bool Source # | |
| EncCBOR Double Source # | |
| EncCBOR Float Source # | |
| EncCBOR Int Source # | |
| EncCBOR Word Source # | |
| DSIGNAlgorithm v ⇒ EncCBOR (SigDSIGN v) Source # | |
| DSIGNAlgorithm v ⇒ EncCBOR (SignKeyDSIGN v) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ SignKeyDSIGN v → Encoding Source # | |
| DSIGNAlgorithm v ⇒ EncCBOR (VerKeyDSIGN v) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ VerKeyDSIGN v → Encoding Source # | |
| KESAlgorithm k ⇒ EncCBOR (SigKES k) Source # | |
| KESAlgorithm k ⇒ EncCBOR (VerKeyKES k) Source # | |
| EncCBOR (CertVRF MockVRF) Source # | |
| EncCBOR (CertVRF SimpleVRF) Source # | |
| EncCBOR (CertVRF PraosVRF) Source # | |
| EncCBOR (OutputVRF v) Source # | |
| EncCBOR (SignKeyVRF MockVRF) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| EncCBOR (SignKeyVRF SimpleVRF) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| EncCBOR (SignKeyVRF PraosVRF) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| EncCBOR (VerKeyVRF MockVRF) Source # | |
| EncCBOR (VerKeyVRF SimpleVRF) Source # | |
| EncCBOR (VerKeyVRF PraosVRF) Source # | |
| EncCBOR a ⇒ EncCBOR (Sized a) Source # | Discards the size. |
| EncCBORGroup a ⇒ EncCBOR (CBORGroup a) Source # | |
| Serialise t ⇒ EncCBOR (WithOrigin t) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ WithOrigin t → Encoding Source # | |
| EncCBOR a ⇒ EncCBOR (StrictMaybe a) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ StrictMaybe a → Encoding Source # | |
| EncCBOR a ⇒ EncCBOR (StrictSeq a) Source # | |
| EncCBOR a ⇒ EncCBOR (Seq a) Source # | |
| EncCBOR a ⇒ EncCBOR (Set a) Source # | |
| EncCBOR a ⇒ EncCBOR (NonEmpty a) Source # | |
| EncCBOR a ⇒ EncCBOR (Ratio a) Source # | |
| EncCBOR a ⇒ EncCBOR (Vector a) Source # | |
| (EncCBOR a, Prim a) ⇒ EncCBOR (Vector a) Source # | |
| (EncCBOR a, Storable a) ⇒ EncCBOR (Vector a) Source # | |
| (EncCBOR a, Unbox a) ⇒ EncCBOR (Vector a) Source # | |
| EncCBOR a ⇒ EncCBOR (Maybe a) Source # | |
| EncCBOR a ⇒ EncCBOR [a] Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| EncCBOR (Fixed p) Source # | |
| DSIGNAlgorithm v ⇒ EncCBOR (SignedDSIGN v a) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ SignedDSIGN v a → Encoding Source # | |
| HashAlgorithm h ⇒ EncCBOR (Hash h a) Source # | |
| VRFAlgorithm v ⇒ EncCBOR (CertifiedVRF v a) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ CertifiedVRF v a → Encoding Source # | |
| (EncCBOR k, EncCBOR v) ⇒ EncCBOR (Map k v) Source # | |
| (EncCBOR a, EncCBOR b) ⇒ EncCBOR (Either a b) Source # | |
| (EncCBOR a, EncCBOR b) ⇒ EncCBOR (a, b) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| EncCBOR (Tokens → Tokens) Source # | |
| EncCBOR a ⇒ EncCBOR (Tagged s a) Source # | |
| (EncCBOR a, EncCBOR b, EncCBOR c) ⇒ EncCBOR (a, b, c) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| (EncCBOR k, EncCBOR v, Vector kv k, Vector vv v) ⇒ EncCBOR (VMap kv vv k v) Source # | |
| (EncCBOR a, EncCBOR b, EncCBOR c, EncCBOR d) ⇒ EncCBOR (a, b, c, d) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| (EncCBOR a, EncCBOR b, EncCBOR c, EncCBOR d, EncCBOR e) ⇒ EncCBOR (a, b, c, d, e) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| (EncCBOR a, EncCBOR b, EncCBOR c, EncCBOR d, EncCBOR e, EncCBOR f) ⇒ EncCBOR (a, b, c, d, e, f) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
| (EncCBOR a, EncCBOR b, EncCBOR c, EncCBOR d, EncCBOR e, EncCBOR f, EncCBOR g) ⇒ EncCBOR (a, b, c, d, e, f, g) Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR | |
newtype PreEncoded Source #
Constructors
| PreEncoded | |
Fields | |
Instances
| EncCBOR PreEncoded Source # | |
Defined in Cardano.Ledger.Binary.Encoding.EncCBOR Methods encCBOR ∷ PreEncoded → Encoding Source # | |
toByronCBOR ∷ EncCBOR a ⇒ a → Encoding Source #
Nested CBOR-in-CBOR
encodeNestedCbor ∷ EncCBOR a ⇒ a → Encoding Source #
Encode and serialise the given a and surround it with the semantic tag 24
In CBOR diagnostic notation:
> 24(hDEADBEEF)
encodeNestedCborBytes ∷ ByteString → Encoding Source #
Like encodeNestedCbor, but assumes nothing about the shape of
input object, so that it must be passed as a binary ByteString blob. It's
the caller responsibility to ensure the input ByteString correspond
indeed to valid, previously-serialised CBOR data.
Tools
runByteBuilder ∷ Int → Builder → ByteString Source #
Run a ByteString Builder using a strategy aimed at making smaller
things efficiently.
It takes a size hint and produces a strict ByteString. This will be fast
when the size hint is the same or slightly bigger than the true size.