Module

Ctl.Internal.Types.Cbor

A partial CBOR decoder, based on RFC 8949

#Cbor

newtype Cbor

A CBOR data item is encoded as a byte string

Constructors

Instances

#RawCborType

type RawCborType = UInt

The initial byte of the head of the data item

#CborType

data CborType

A structured representation of the head of the data item

Constructors

#runParser

runParser :: forall (a :: Type). Parser a -> Cbor -> Either CborParseError a

#cborType

cborType :: Parser CborType

Decodes the head of the data item into CborType

#takeN

takeN :: UInt -> Parser (Array UInt)

Same as takeN', except returns Array UInt

#takeN'

takeN' :: UInt -> Parser ByteArray

Consume and return n bytes from the input, throwing an exception if there is not enough

#toByteArray

toByteArray :: Cbor -> Either CborParseError ByteArray

Extract a ByteArray if the Cbor was a byte string

#fromBytes

fromBytes :: Array UInt -> UInt

Convert an array of bytes in network order into an unsigned integer

Modules