Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Helper data type for block, tx attributes
Map with integer 1-byte keys, arbitrary-type polymorph values. Needed primarily for partial serialization. Values are either parsed and put to some constructor or left as unparsed.
Synopsis
- newtype UnparsedFields = UnparsedFields (Map Word8 ByteString)
- data Attributes h = Attributes {
- attrData ∷ !h
- attrRemain ∷ !UnparsedFields
- attributesAreKnown ∷ Attributes a → Bool
- unknownAttributesLength ∷ Attributes a → Int
- encCBORAttributes ∷ ∀ t. [(Word8, t → ByteString)] → Attributes t → Encoding
- decCBORAttributes ∷ ∀ t s. t → (Word8 → ByteString → t → Decoder s (Maybe t)) → Decoder s (Attributes t)
- mkAttributes ∷ h → Attributes h
- dropAttributes ∷ Dropper s
- dropEmptyAttributes ∷ Dropper s
Documentation
newtype UnparsedFields Source #
Representation of unparsed fields in Attributes. Newtype wrapper is used for clear backward compatibility between previous representation (which was just a single ByteString) during transition from Store to CBOR.
Instances
data Attributes h Source #
Convenient wrapper for the datatype to represent it (in binary format) as k-v map
Attributes | |
|
Instances
attributesAreKnown ∷ Attributes a → Bool Source #
Check whether all data from Attributes
is known, i. e. was successfully
parsed into some structured data
encCBORAttributes ∷ ∀ t. [(Word8, t → ByteString)] → Attributes t → Encoding Source #
decCBORAttributes ∷ ∀ t s. t → (Word8 → ByteString → t → Decoder s (Maybe t)) → Decoder s (Attributes t) Source #
mkAttributes ∷ h → Attributes h Source #
dropAttributes ∷ Dropper s Source #
dropEmptyAttributes ∷ Dropper s Source #
Drop `Attributes ()` making sure that the UnparsedFields
are empty