Decode a compact-u16 value. Fails on encodings longer than 3 bytes, on aliased (non-canonical) encodings, on an invalid third byte, and on values exceeding Word16.
Modulesolana-haskell-sdk-1.3.0.0GHC2021
Network.Solana.Core.Compact
Solana serializes lengths as compact-u16: a Word16 packed into 1–3 bytes, little-endian, 7 data bits per byte, with the high bit of each byte flagging a continuation byte. The third byte may only carry 2 data bits, and aliased (non-canonical) encodings are rejected when decoding. A CompactArray is a sequence serialized as its compact-u16 length followed by the serialized items.
- 1 type
- 7 values
- Packagesolana-haskell-sdk-1.3.0.0
- Exports8
- LanguageGHC2021
- LicenceApache-2.0
- SourceCompact.hs
Encode a Word16 as compact-u16 (1–3 bytes).
Run putCompactU16 to a lazy byte string.
Run getCompactU16 over a lazy byte string, returning the decoder's error message on failure.
Instances6Eq, Ord, Show, Generic, Binary, Rep
Eq a => Eq (CompactArray a)Defined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CompactOrd a => Ord (CompactArray a)Defined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CompactShow a => Show (CompactArray a)Defined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CompactGeneric (CompactArray a)Defined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.CompactBinary a => Binary (CompactArray a)Defined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.Compacttype Rep (CompactArray a) = D1 ('MetaDataDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.Core.Compact"CompactArray"
"Network.Solana.Core.Compact"
"solana-haskell-sdk-1.3.0.0-JMJNnl7jmEh90dthY33ZzW"
'False) (C1 ('MetaCons"CompactArray"
'PrefixI 'True) (S1 ('MetaSel ('Just"getCompactArrayLength"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word16) :*: S1 ('MetaSel ('Just"unCompact"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))
Wrap a list into a CompactArray, recording its length. The length is truncated to Word16.
The items of the array.
The recorded number of items.