Safe Haskell | None |
---|---|
Language | Haskell2010 |
Facilities for using Encoding
s 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 Encoding
s, 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 Encoding
s, 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
- getWithEncoding :: Encoding ty -> Get ty
- putWithEncoding :: Encoding ty -> ty -> Put
Documentation
Use an Encoding
to extract a ty
from binary data.
Use an Encoding
to write a ty
out as binary data.