morley-1.16.3: Developer tools for the Michelson Language
Safe HaskellNone
LanguageHaskell2010

Morley.Util.Binary

Description

This module contains helper functions to deal with encoding and decoding of binary data.

Synopsis

Documentation

newtype UnpackError Source #

Any decoding error.

Constructors

UnpackError 

Fields

data TaggedDecoder a Source #

Describes how decodeWithTag should decode tag-dependent data. We expect bytes of such structure: tdTag followed by a bytestring which will be parsed with tdDecoder.

Constructors

TaggedDecoder 

Fields

(#:) :: Word8 -> Get a -> TaggedDecoder a infixr 0 Source #

Alias for TaggedDecoder constructor.

getByteStringCopy :: Int -> Get ByteString Source #

Get a bytestring of the given length leaving no references to the original data in serialized form.

getRemainingByteStringCopy :: Get ByteString Source #

Get remaining available bytes.

Note that reading all remaining decoded input may be expensive and is thus discouraged, use can use this function only when you know that amount of data to be consumed is limited, e.g. within decodeBytesLike call.

unknownTag :: String -> Word8 -> Get a Source #

Fail with "unknown tag" error.