arith-encode-1.0.2: A practical arithmetic encoding (aka Godel numbering) library.

Safe HaskellNone
LanguageHaskell2010

Data.ArithEncode.Binary

Description

Facilities for using Encodings as binary serializers. The resulting binary format is, for the most part, determined by the Encoding, and therefore is within a constant factor of succintness.

In all cases, little-endian byte ordering is used in order to allow for very large data to be read in an decoded lazily. (Note: Haskell's libraries do not provide support for this functionality at this time).

For finite Encodings, the binary format is just the little-endian encoding of the encoded value, using as few bytes as necessary to represent the largest encoded value.

For infinite Encodings, the binary format includes a length field for most values. The current encoding uses length fields of different sizes, depending on the size of the encoded value.

Synopsis

Documentation

getWithEncoding Source #

Arguments

:: Encoding ty

The encoding to use.

-> Get ty 

Use an Encoding to extract a ty from binary data.

putWithEncoding Source #

Arguments

:: Encoding ty

The encoding to use.

-> ty

The value to encode.

-> Put 

Use an Encoding to write a ty out as binary data.