Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- serialize ∷ EncCBOR a ⇒ Version → a → ByteString
- serialize' ∷ EncCBOR a ⇒ Version → a → ByteString
- serializeBuilder ∷ EncCBOR a ⇒ Version → a → Builder
- hashWithEncoder ∷ ∀ h a. HashAlgorithm h ⇒ Version → (a → Encoding) → a → Hash h a
- hashEncCBOR ∷ ∀ h a. (HashAlgorithm h, EncCBOR a) ⇒ Version → a → Hash h a
- module Cardano.Ledger.Binary.Version
- module Cardano.Ledger.Binary.Encoding.Encoder
- module Cardano.Ledger.Binary.Encoding.EncCBOR
- encodeNestedCbor ∷ EncCBOR a ⇒ a → Encoding
- encodeNestedCborBytes ∷ ByteString → Encoding
- nestedCborSizeExpr ∷ Size → Size
- nestedCborBytesSizeExpr ∷ Size → Size
- runByteBuilder ∷ Int → Builder → ByteString
- encCBORMaybe ∷ (a → Encoding) → Maybe 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 ∷ ∀ 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 #
Nested CBOR-in-CBOR
encodeNestedCbor ∷ EncCBOR a ⇒ a → Encoding Source #
Encode and serialise the given a
and sorround 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.
Deprecated
encCBORMaybe ∷ (a → Encoding) → Maybe a → Encoding Source #
Deprecated: In favor of encodeMaybe