RefSerialize: Write to and read from Strings maintaining internal memory references

[ bsd3, data, database, library, parsing ] [ Propose Tags ]

Read, Show and Data.Binary do not check for internal data references to the same address. As a result, the data is duplicated when serialized. This is a waste of space in the filesystem and also a waste of serialization time. but the worst consequence is that, when the serialized data is read, it allocates multiple copies for the same object when referenced multiple times. Because multiple referenced data is very typical in a pure language such is Haskell, this means that the resulting data loose the beatiful economy of space and processing time that referential transparency permits.

Every instance of Show/Read can be an instance of Data.RefSerialize.

This package allows the serialization and deserialization of large data structures without duplication of data, with the result of optimized performance and memory usage. Since the serialized data is also human readable, It is also useful for debugging purposes.

The deserializer contains a subset of Parsec.Token for defining deserializing parsers.

the serialized string has the form:

expr( var1, ...varn) where  var1=value1,..valn=valueN

so that the string can agree with the haskell syntax.

See demo.hs and tutorial.

in this release:

  • bug in 0.2.5 corrected: empty lists were written with two indirections (insertVar . insertVar). That caused an error in readp

  • bug in 0.2.6 corrected for lists

  • removed the problematic instance (Show a, Read a) => Serialize a

  • Added instances for standard datatypes. More "deeper" instances favouring more variable usage

  • instance of Serialize [a] changed

To do:

  • derived instances for Data.Binary

  • serialization to/from ByteStings

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.5, 0.2.6, 0.2.7, 0.2.8, 0.2.8.1, 0.3.0.0, 0.3.0.1, 0.3.1.0, 0.3.1.1, 0.3.1.2, 0.3.1.3, 0.3.1.4, 0.4.0
Dependencies base (>=3 && <4), containers [details]
License BSD-3-Clause
Author Alberto Gómez Corona
Maintainer agocorona@gmail.com
Category Parsing, Data, Database
Uploaded by AlbertoCorona at 2010-07-19T18:09:21Z
Distributions LTSHaskell:0.4.0, NixOS:0.4.0, Stackage:0.4.0
Reverse Dependencies 4 direct, 6 indirect [details]
Downloads 18811 total (57 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]