Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Provides MemoBytes internals
Warning
This module is considered internal.
The contents of this module may change in any way whatsoever and without any warning between minor versions of this package.
Synopsis
- data MemoBytes t era where
- Memo' {
- mbRawType ∷ !(t era)
- mbBytes ∷ ShortByteString
- mbHash ∷ SafeHash (MemoHashIndex t)
- pattern Memo ∷ Era era ⇒ t era → ShortByteString → MemoBytes t era
- Memo' {
- type family MemoHashIndex (t ∷ Type → Type) ∷ Type
- type Mem t era = Annotator (MemoBytes t era)
- mkMemoBytes ∷ ∀ era t. t era → ByteString → MemoBytes t era
- getMemoBytesType ∷ MemoBytes t era → t era
- getMemoBytesHash ∷ MemoBytes t era → SafeHash (MemoHashIndex t)
- memoBytes ∷ ∀ era w t. Era era ⇒ Encode w (t era) → MemoBytes t era
- shorten ∷ ByteString → ShortByteString
- showMemo ∷ Show (t era) ⇒ MemoBytes t era → String
- printMemo ∷ Show (t era) ⇒ MemoBytes t era → IO ()
- shortToLazy ∷ ShortByteString → ByteString
- contentsEq ∷ Eq (t era) ⇒ MemoBytes t era → MemoBytes t era → Bool
- class Memoized t where
- mkMemoized ∷ ∀ era t. (Era era, EncCBOR (RawType t era), Memoized t) ⇒ RawType t era → t era
- decodeMemoized ∷ Decoder s (t era) → Decoder s (MemoBytes t era)
- getMemoSafeHash ∷ Memoized t ⇒ t era → SafeHash (MemoHashIndex (RawType t))
- getMemoRawType ∷ Memoized t ⇒ t era → RawType t era
- zipMemoRawType ∷ (Memoized t1, Memoized t2) ⇒ (RawType t1 era → RawType t2 era → a) → t1 era → t2 era → a
- eqRawType ∷ ∀ t era. (Memoized t, Eq (RawType t era)) ⇒ t era → t era → Bool
- getMemoRawBytes ∷ Memoized t ⇒ t era → ShortByteString
- lensMemoRawType ∷ (Era era, EncCBOR (RawType t era), Memoized t) ⇒ (RawType t era → a) → (RawType t era → b → RawType t era) → Lens (t era) (t era) a b
- getterMemoRawType ∷ Memoized t ⇒ (RawType t era → a) → SimpleGetter (t era) a
- class EqRaw a where
Documentation
Pair together a type t
and its serialization. Used to encode a type
that is serialized over the network, and to remember the original bytes
that were used to transmit it. Important since hashes are computed
from the serialization of a type, and EncCBOR instances do not have unique
serializations.
Memo' | |
|
pattern Memo ∷ Era era ⇒ t era → ShortByteString → MemoBytes t era |
Instances
type family MemoHashIndex (t ∷ Type → Type) ∷ Type Source #
Instances
type MemoHashIndex PlutusData Source # | |
Defined in Cardano.Ledger.Plutus.Data |
type Mem t era = Annotator (MemoBytes t era) Source #
Useful when deriving DecCBOR(Annotator T) deriving via (Mem T) instance (Era era) => DecCBOR (Annotator T)
mkMemoBytes ∷ ∀ era t. t era → ByteString → MemoBytes t era Source #
Smart constructor
getMemoBytesType ∷ MemoBytes t era → t era Source #
Extract the inner type of the MemoBytes
getMemoBytesHash ∷ MemoBytes t era → SafeHash (MemoHashIndex t) Source #
Extract the hash value of the binary representation of the MemoBytes
memoBytes ∷ ∀ era w t. Era era ⇒ Encode w (t era) → MemoBytes t era Source #
Create MemoBytes from its CBOR encoding
shorten ∷ ByteString → ShortByteString Source #
Turn a lazy bytestring into a short bytestring.
showMemo ∷ Show (t era) ⇒ MemoBytes t era → String Source #
Turn a MemoBytes into a string, Showing both its internal structure and its original bytes. Useful since the Show instance of MemoBytes does not display the original bytes.
shortToLazy ∷ ShortByteString → ByteString Source #
Helper function. Converts a short bytestring to a lazy bytestring.
contentsEq ∷ Eq (t era) ⇒ MemoBytes t era → MemoBytes t era → Bool Source #
Returns true if the contents of the MemoBytes are equal
Memoized
Class that relates the actual type with its raw and byte representations
mkMemoized ∷ ∀ era t. (Era era, EncCBOR (RawType t era), Memoized t) ⇒ RawType t era → t era Source #
Construct memoized type from the raw type using its EncCBOR instance
getMemoSafeHash ∷ Memoized t ⇒ t era → SafeHash (MemoHashIndex (RawType t)) Source #
Extract memoized SafeHash
getMemoRawType ∷ Memoized t ⇒ t era → RawType t era Source #
Extract the raw type from the memoized version
zipMemoRawType ∷ (Memoized t1, Memoized t2) ⇒ (RawType t1 era → RawType t2 era → a) → t1 era → t2 era → a Source #
This is a helper function that operates on raw types of two memoized types.
getMemoRawBytes ∷ Memoized t ⇒ t era → ShortByteString Source #
Extract the raw bytes from the memoized version
lensMemoRawType ∷ (Era era, EncCBOR (RawType t era), Memoized t) ⇒ (RawType t era → a) → (RawType t era → b → RawType t era) → Lens (t era) (t era) a b Source #
This is a helper Lens creator for any Memoized type.
getterMemoRawType ∷ Memoized t ⇒ (RawType t era → a) → SimpleGetter (t era) a Source #
This is a helper SimpleGetter creator for any Memoized type
Raw equality
Type class that implements equality on the Haskell type, ignoring any of the potentially memoized binary representation of the type.
Nothing
Instances
EqRaw BootstrapWitness Source # | |
Defined in Cardano.Ledger.Keys.Bootstrap | |
Typeable kr ⇒ EqRaw (WitVKey kr) Source # | |