cardano-ledger-binary-1.6.0.0: Binary serialization library used throughout ledger
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Binary.Encoding

Synopsis

Running decoders

serializeEncCBOR 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.

serializeBuilderEncCBOR a ⇒ Version → a → Builder Source #

Serialize into a Builder. Useful if you want to throw other ByteStrings around it.

Hash

hashWithEncoder ∷ ∀ h a. HashAlgorithm h ⇒ Version → (a → Encoding) → a → Hash h a Source #

hashEncCBOR ∷ ∀ h a. (HashAlgorithm h, EncCBOR a) ⇒ Version → a → Hash h a Source #

Decoders

data Tokens 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

Instances

Instances details
Show Tokens 
Instance details

Defined in Codec.CBOR.Encoding

Eq Tokens 
Instance details

Defined in Codec.CBOR.Encoding

Methods

(==)TokensTokensBool Source #

(/=)TokensTokensBool Source #

ToCBOR (TokensTokens) 
Instance details

Defined in Cardano.Binary.ToCBOR

Methods

toCBOR ∷ (TokensTokens) → Encoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (TokensTokens) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [TokensTokens] → Size Source #

EncCBOR (TokensTokens) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ (TokensTokens) → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (TokensTokens) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [TokensTokens] → Size Source #

withCurrentEncodingVersion ∷ (VersionEncoding) → Encoding Source #

Get access to the current version being used in the encoder

enforceEncodingVersionVersionEncodingEncoding 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 Version

Encoding

Use this encoder if current encoder version is lower than the supplied Version

Encoding 

Conditionoly choose the encoder newer or older deceder, depending on the current version. Supplied version acts as a pivot.

Example

Custom

encodeMaybe ∷ (a → Encoding) → Maybe a → Encoding Source #

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

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

encodeTuple ∷ (a → Encoding) → (b → Encoding) → (a, b) → Encoding Source #

encodeRatio ∷ (t → Encoding) → Ratio t → Encoding Source #

encodeEnumEnum a ⇒ a → Encoding Source #

Containers

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

encodeSeq ∷ (a → Encoding) → Seq a → Encoding Source #

Encode a Seq. Variable length encoding for Sequences larger than 23 elements, otherwise exact 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.

encodeVMap ∷ (Vector kv k, Vector vv v) ⇒ (k → Encoding) → (v → Encoding) → VMap kv vv k v → Encoding Source #

Mimics Map encoder encodeMap identically.

encodeVectorVector 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

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.

Helpers

encodeFoldableEncoderFoldable 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.

encodeFoldableAsIndefLenListFoldable 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.

lengthThresholdInt 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.

Time

Network

Original

class Typeable a ⇒ EncCBOR a where Source #

Minimal complete definition

Nothing

Methods

encCBOR ∷ a → Encoding Source #

default encCBORToCBOR a ⇒ a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy a → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [a] → Size Source #

Instances

Instances details
EncCBOR Void Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVoidEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy VoidSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Void] → Size Source #

EncCBOR Int16 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORInt16Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy Int16Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Int16] → Size Source #

EncCBOR Int32 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORInt32Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy Int32Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Int32] → Size Source #

EncCBOR Int64 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORInt64Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy Int64Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Int64] → Size Source #

EncCBOR Int8 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORInt8Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy Int8Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Int8] → Size Source #

EncCBOR Word16 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORWord16Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy Word16Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Word16] → Size Source #

EncCBOR Word32 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORWord32Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy Word32Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Word32] → Size Source #

EncCBOR Word64 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORWord64Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy Word64Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Word64] → Size Source #

EncCBOR Word8 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORWord8Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy Word8Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Word8] → Size Source #

EncCBOR ByteString Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORByteStringEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy ByteStringSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [ByteString] → Size Source #

EncCBOR ByteString Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORByteStringEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy ByteStringSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [ByteString] → Size Source #

EncCBOR ShortByteString Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR Proof Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORProofEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy ProofSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Proof] → Size Source #

EncCBOR SignKey Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORSignKeyEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy SignKeySize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [SignKey] → Size Source #

EncCBOR VerKey Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVerKeyEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy VerKeySize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [VerKey] → Size Source #

EncCBOR PreEncoded Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORPreEncodedEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy PreEncodedSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [PreEncoded] → Size Source #

EncCBOR Encoding Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOREncodingEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy EncodingSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Encoding] → Size Source #

EncCBOR Version Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVersionEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy VersionSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Version] → Size Source #

EncCBOR BlockNo Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORBlockNoEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy BlockNoSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [BlockNo] → Size Source #

EncCBOR EpochInterval Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR EpochNo Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOREpochNoEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy EpochNoSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [EpochNo] → Size Source #

EncCBOR EpochSize Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOREpochSizeEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy EpochSizeSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [EpochSize] → Size Source #

EncCBOR SlotNo Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORSlotNoEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy SlotNoSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [SlotNo] → Size Source #

EncCBOR SystemStart Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORSystemStartEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy SystemStartSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [SystemStart] → Size Source #

EncCBOR ByteArray Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORByteArrayEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy ByteArraySize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [ByteArray] → Size Source #

EncCBOR SlicedByteArray Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR Encoding Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOREncodingEncoding0 Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy EncodingSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Encoding] → Size Source #

EncCBOR Term Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORTermEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy TermSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Term] → Size Source #

EncCBOR ByteArray Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORByteArrayEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy ByteArraySize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [ByteArray] → Size Source #

EncCBOR IPv4 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORIPv4Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy IPv4Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [IPv4] → Size Source #

EncCBOR IPv6 Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORIPv6Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy IPv6Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [IPv6] → Size Source #

EncCBOR Data Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORDataEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy DataSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Data] → Size Source #

EncCBOR ScriptContext Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR ScriptContext Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR ScriptContext Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR Text Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORTextEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy TextSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Text] → Size Source #

EncCBOR UTCTime Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORUTCTimeEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy UTCTimeSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [UTCTime] → Size Source #

EncCBOR Integer Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORIntegerEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy IntegerSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Integer] → Size Source #

EncCBOR Natural Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORNaturalEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy NaturalSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Natural] → Size Source #

EncCBOR () Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ () → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy () → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [()] → Size Source #

EncCBOR Bool Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORBoolEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy BoolSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Bool] → Size Source #

EncCBOR Double Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORDoubleEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy DoubleSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Double] → Size Source #

EncCBOR Float Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORFloatEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy FloatSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Float] → Size Source #

EncCBOR Int Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORIntEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy IntSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Int] → Size Source #

EncCBOR Word Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORWordEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy WordSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Word] → Size Source #

EncCBOR a ⇒ EncCBOR (Ratio a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORRatio a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Ratio a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Ratio a] → Size Source #

DSIGNAlgorithm v ⇒ EncCBOR (SigDSIGN v) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORSigDSIGN v → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (SigDSIGN v) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [SigDSIGN v] → Size Source #

DSIGNAlgorithm v ⇒ EncCBOR (SignKeyDSIGN v) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORSignKeyDSIGN v → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (SignKeyDSIGN v) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [SignKeyDSIGN v] → Size Source #

DSIGNAlgorithm v ⇒ EncCBOR (VerKeyDSIGN v) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVerKeyDSIGN v → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (VerKeyDSIGN v) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [VerKeyDSIGN v] → Size Source #

KESAlgorithm k ⇒ EncCBOR (SigKES k) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORSigKES k → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (SigKES k) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [SigKES k] → Size Source #

KESAlgorithm k ⇒ EncCBOR (VerKeyKES k) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVerKeyKES k → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (VerKeyKES k) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [VerKeyKES k] → Size Source #

EncCBOR (CertVRF MockVRF) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORCertVRF MockVRFEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (CertVRF MockVRF) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [CertVRF MockVRF] → Size Source #

EncCBOR (CertVRF SimpleVRF) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR (CertVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Typeable v ⇒ EncCBOR (OutputVRF v) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOROutputVRF v → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (OutputVRF v) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [OutputVRF v] → Size Source #

EncCBOR (SignKeyVRF MockVRF) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR (SignKeyVRF SimpleVRF) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR (SignKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR (VerKeyVRF MockVRF) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR (VerKeyVRF SimpleVRF) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR (VerKeyVRF PraosVRF) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

EncCBOR a ⇒ EncCBOR (Sized a) Source #

Discards the size.

Instance details

Defined in Cardano.Ledger.Binary.Decoding.Sized

Methods

encCBORSized a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Sized a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Sized a] → Size Source #

Typeable xs ⇒ EncCBOR (LengthOf xs) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORLengthOf xs → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (LengthOf xs) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [LengthOf xs] → Size Source #

EncCBORGroup a ⇒ EncCBOR (CBORGroup a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Group

Methods

encCBORCBORGroup a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (CBORGroup a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [CBORGroup a] → Size Source #

(Serialise t, Typeable t) ⇒ EncCBOR (WithOrigin t) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORWithOrigin t → Encoding Source #

encodedSizeExpr ∷ (∀ t0. EncCBOR t0 ⇒ Proxy t0 → Size) → Proxy (WithOrigin t) → Size Source #

encodedListSizeExpr ∷ (∀ t0. EncCBOR t0 ⇒ Proxy t0 → Size) → Proxy [WithOrigin t] → Size Source #

EncCBOR a ⇒ EncCBOR (StrictMaybe a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORStrictMaybe a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (StrictMaybe a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [StrictMaybe a] → Size Source #

EncCBOR a ⇒ EncCBOR (StrictSeq a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORStrictSeq a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (StrictSeq a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [StrictSeq a] → Size Source #

EncCBOR a ⇒ EncCBOR (Seq a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORSeq a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Seq a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Seq a] → Size Source #

(Ord a, EncCBOR a) ⇒ EncCBOR (Set a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORSet a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Set a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Set a] → Size Source #

EncCBOR a ⇒ EncCBOR (Vector a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVector a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Vector a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Vector a] → Size Source #

(EncCBOR a, Prim a) ⇒ EncCBOR (Vector a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVector a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Vector a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Vector a] → Size Source #

(EncCBOR a, Storable a) ⇒ EncCBOR (Vector a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVector a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Vector a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Vector a] → Size Source #

(EncCBOR a, Unbox a) ⇒ EncCBOR (Vector a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVector a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Vector a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Vector a] → Size Source #

EncCBOR a ⇒ EncCBOR (NonEmpty a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORNonEmpty a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (NonEmpty a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [NonEmpty a] → Size Source #

EncCBOR a ⇒ EncCBOR (Maybe a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORMaybe a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Maybe a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Maybe a] → Size Source #

EncCBOR a ⇒ EncCBOR [a] Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ [a] → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [a] → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [[a]] → Size Source #

(EncCBOR a, EncCBOR b) ⇒ EncCBOR (Either a b) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOREither a b → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Either a b) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Either a b] → Size Source #

Typeable p ⇒ EncCBOR (Fixed p) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORFixed p → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Fixed p) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Fixed p] → Size Source #

(DSIGNAlgorithm v, Typeable a) ⇒ EncCBOR (SignedDSIGN v a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORSignedDSIGN v a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (SignedDSIGN v a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [SignedDSIGN v a] → Size Source #

(HashAlgorithm h, Typeable a) ⇒ EncCBOR (Hash h a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORHash h a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Hash h a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Hash h a] → Size Source #

(VRFAlgorithm v, Typeable a) ⇒ EncCBOR (CertifiedVRF v a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORCertifiedVRF v a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (CertifiedVRF v a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [CertifiedVRF v a] → Size Source #

(Ord k, EncCBOR k, EncCBOR v) ⇒ EncCBOR (Map k v) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORMap k v → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Map k v) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Map k v] → Size Source #

EncCBOR (TokensTokens) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ (TokensTokens) → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (TokensTokens) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [TokensTokens] → Size Source #

(EncCBOR a, EncCBOR b) ⇒ EncCBOR (a, b) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ (a, b) → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (a, b) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [(a, b)] → Size Source #

(Typeable s, EncCBOR a) ⇒ EncCBOR (Tagged s a) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORTagged s a → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Tagged s a) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Tagged s a] → Size Source #

(EncCBOR a, EncCBOR b, EncCBOR c) ⇒ EncCBOR (a, b, c) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ (a, b, c) → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (a, b, c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [(a, b, c)] → Size Source #

(Ord k, EncCBOR k, EncCBOR v, Vector kv k, Vector vv v, Typeable kv, Typeable vv) ⇒ EncCBOR (VMap kv vv k v) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORVMap kv vv k v → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (VMap kv vv k v) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [VMap kv vv k v] → Size Source #

(EncCBOR a, EncCBOR b, EncCBOR c, EncCBOR d) ⇒ EncCBOR (a, b, c, d) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ (a, b, c, d) → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (a, b, c, d) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [(a, b, c, d)] → Size Source #

(EncCBOR a, EncCBOR b, EncCBOR c, EncCBOR d, EncCBOR e) ⇒ EncCBOR (a, b, c, d, e) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ (a, b, c, d, e) → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (a, b, c, d, e) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [(a, b, c, d, e)] → Size Source #

(EncCBOR a, EncCBOR b, EncCBOR c, EncCBOR d, EncCBOR e, EncCBOR f) ⇒ EncCBOR (a, b, c, d, e, f) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ (a, b, c, d, e, f) → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (a, b, c, d, e, f) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [(a, b, c, d, e, f)] → Size Source #

(EncCBOR a, EncCBOR b, EncCBOR c, EncCBOR d, EncCBOR e, EncCBOR f, EncCBOR g) ⇒ EncCBOR (a, b, c, d, e, f, g) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBOR ∷ (a, b, c, d, e, f, g) → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (a, b, c, d, e, f, g) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [(a, b, c, d, e, f, g)] → Size Source #

withWordSize ∷ (Integral s, Integral a) ⇒ s → a Source #

Compute encoded size of an integer

newtype PreEncoded Source #

Constructors

PreEncoded 

Instances

Instances details
EncCBOR PreEncoded Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORPreEncodedEncoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy PreEncodedSize Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [PreEncoded] → Size Source #

toByronCBOREncCBOR a ⇒ a → Encoding Source #

Convert a versioned EncCBOR instance to a plain Encoding using Byron protocol version.

Size of expressions

data Range b Source #

A range of values. Should satisfy the invariant forall x. lo x <= hi x.

Constructors

Range 

Fields

  • lo ∷ b
     
  • hi ∷ b
     

Instances

Instances details
(Ord b, Num b) ⇒ Num (Range b) Source #

The Num instance for Range uses interval arithmetic. Note that the signum method is not lawful: if the interval x includes 0 in its interior but is not symmetric about 0, then abs x * signum x /= x.

Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

(+)Range b → Range b → Range b Source #

(-)Range b → Range b → Range b Source #

(*)Range b → Range b → Range b Source #

negateRange b → Range b Source #

absRange b → Range b Source #

signumRange b → Range b Source #

fromIntegerIntegerRange b Source #

Buildable (Range Natural) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

szEval ∷ (∀ t. EncCBOR t ⇒ (Proxy t → Size) → Proxy t → Range Natural) → SizeRange Natural Source #

Fully evaluate a size expression by applying the given function to any suspended computations. szEval g effectively turns each "thunk" of the form TodoF f x into g x, then evaluates the result.

type Size = Fix SizeF Source #

Expressions describing the statically-computed size bounds on a type's possible values.

data Case t Source #

An individual labeled case.

Constructors

Case Text t 

Instances

Instances details
Functor Case Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

fmap ∷ (a → b) → Case a → Case b Source #

(<$) ∷ a → Case b → Case a Source #

Buildable t ⇒ Buildable (Case t) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

buildCase t → Builder Source #

caseValueCase t → t Source #

Discard the label on a case.

newtype LengthOf xs Source #

A type used to represent the length of a value in Size computations.

Constructors

LengthOf xs 

Instances

Instances details
Typeable xs ⇒ EncCBOR (LengthOf xs) Source # 
Instance details

Defined in Cardano.Ledger.Binary.Encoding.EncCBOR

Methods

encCBORLengthOf xs → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (LengthOf xs) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [LengthOf xs] → Size Source #

data SizeOverride Source #

Override mechanisms to be used with szWithCtx.

Constructors

SizeConstant Size

Replace with a fixed Size.

SizeExpression ((∀ a. EncCBOR a ⇒ Proxy a → Size) → Size)

Recursively compute the size.

SelectCases [Text]

Select only a specific case from a CasesF.

isTodoSizeBool Source #

Is this expression a thunk?

szCases ∷ [Case Size] → Size Source #

Create a case expression from individual cases.

szLazyEncCBOR a ⇒ Proxy a → Size Source #

Evaluate the expression lazily, by immediately creating a thunk that will evaluate its contents lazily.

ghci> putStrLn $ pretty $ szLazy (Proxy @TxAux)
(_ :: TxAux)

szGreedyEncCBOR a ⇒ Proxy a → Size Source #

Evaluate an expression greedily. There may still be thunks in the result, for types that did not provide a custom encodedSizeExpr method in their EncCBOR instance.

ghci> putStrLn $ pretty $ szGreedy (Proxy @TxAux)
(0 + { TxAux=(2 + ((0 + (((1 + (2 + ((_ :: LengthOf [TxIn]) * (2 + { TxInUtxo=(2 + ((1 + 34) + { minBound=1 maxBound=5 })) })))) + (2 + ((_ :: LengthOf [TxOut]) * (0 + { TxOut=(2 + ((0 + ((2 + ((2 + withWordSize((((1 + 30) + (_ :: Attributes AddrAttributes)) + 1))) + (((1 + 30) + (_ :: Attributes AddrAttributes)) + 1))) + { minBound=1 maxBound=5 })) + { minBound=1 maxBound=9 })) })))) + (_ :: Attributes ()))) + (_ :: Vector TxInWitness))) })

szForceSizeSize Source #

Force any thunks in the given Size expression.

ghci> putStrLn $ pretty $ szForce $ szLazy (Proxy @TxAux)
(0 + { TxAux=(2 + ((0 + (_ :: Tx)) + (_ :: Vector TxInWitness))) })

szWithCtxEncCBOR a ⇒ Map TypeRep SizeOverrideProxy a → Size Source #

Greedily compute the size bounds for a type, using the given context to override sizes for specific types.

szSimplifySizeEither Size (Range Natural) Source #

Simplify the given Size, resulting in either the simplified Size or, if it was fully simplified, an explicit upper and lower bound.

apMonoText → (NaturalNatural) → SizeSize Source #

Apply a monotonically increasing function to the expression. There are three cases when applying f to a Size expression: * When applied to a value x, compute f x. * When applied to cases, apply to each case individually. * In all other cases, create a deferred application of f.

Crypto

encodedVerKeyDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (VerKeyDSIGN v) → Size Source #

Size expression for VerKeyDSIGN which is using sizeVerKeyDSIGN encoded as Size.

encodedSignKeyDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (SignKeyDSIGN v) → Size Source #

Size expression for SignKeyDSIGN which is using sizeSignKeyDSIGN encoded as Size.

encodedSigDSIGNSizeExpr ∷ ∀ v. DSIGNAlgorithm v ⇒ Proxy (SigDSIGN v) → Size Source #

Size expression for SigDSIGN which is using sizeSigDSIGN encoded as Size.

encodedVerKeyKESSizeExpr ∷ ∀ v. KESAlgorithm v ⇒ Proxy (VerKeyKES v) → Size Source #

Size expression for VerKeyKES which is using sizeVerKeyKES encoded as Size.

encodedSignKeyKESSizeExpr ∷ ∀ v. KESAlgorithm v ⇒ Proxy (SignKeyKES v) → Size Source #

Size expression for SignKeyKES which is using sizeSignKeyKES encoded as Size.

encodedSigKESSizeExpr ∷ ∀ v. KESAlgorithm v ⇒ Proxy (SigKES v) → Size Source #

Size expression for SigKES which is using sizeSigKES encoded as Size.

encodedVerKeyVRFSizeExpr ∷ ∀ v. VRFAlgorithm v ⇒ Proxy (VerKeyVRF v) → Size Source #

Size expression for VerKeyVRF which is using sizeVerKeyVRF encoded as Size.

encodedSignKeyVRFSizeExpr ∷ ∀ v. VRFAlgorithm v ⇒ Proxy (SignKeyVRF v) → Size Source #

Size expression for SignKeyVRF which is using sizeSignKeyVRF encoded as Size

encodedCertVRFSizeExpr ∷ ∀ v. VRFAlgorithm v ⇒ Proxy (CertVRF v) → Size Source #

Size expression for CertVRF which is using sizeCertVRF encoded as Size.

Nested CBOR-in-CBOR

encodeNestedCborEncCBOR a ⇒ a → Encoding Source #

Encode and serialise the given a and sorround it with the semantic tag 24 In CBOR diagnostic notation: >>> 24(hDEADBEEF)

encodeNestedCborBytesByteStringEncoding 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

runByteBuilderIntBuilderByteString 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.