The genericserialize package

[Tags:bsd3, library]

GenericSerialize is a library for serialization using the existing generic-programming framework.

It is often advocated that support for serialization should be added to the compiler (e.g. in the form of a deriving(Binary)). With this I intend to show that the existing infrastructure is sufficient, and has some advantages over a dedicated serialization interface.

The main advantage that generic serialization posseses is that it is possible to simultaneously have several serialization modes. While interfaces such as AltBinary allow writing to any type of stream, the data format is fixed. By contrast, GenericSerialize supports multiple serialization modes; while the only currently existing module is for a subset of R5RS s-expressions, that module is less than 100 lines of code and is almost pure grammar.


[Skip to Readme]

Properties

Versions 0.1
Dependencies base [details]
License BSD3
Author Stefan O'Rear
Maintainer Stefan O'Rear <stefanor@cox.net>
Stability Alpha
Category Data
Uploaded Sun Mar 16 04:51:45 UTC 2008 by GwernBranwen
Distributions NixOS:0.1
Downloads 362 total (6 in the last 30 days)
Votes
0 []
Status Docs uploaded by user
Build status unknown [no reports yet]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for genericserialize

Readme for genericserialize-0.1

This is genericserialize, a library of functions using the "Scrap your
boilerplate" framework to serialize arbitrary data.

Basic usage:

*Data.Generics.Serialization.SExp> buildList (sexpSerialize (True,False))
"(~l,~r #t #f)"
*Data.Generics.Serialization.SExp> buildList (sexpSerialize [True,False])
"(#t #f)"
*Data.Generics.Serialization.SExp> buildList (sexpSerialize (Just "help"))
"(Just \"help\")"
*Data.Generics.Serialization.SExp> withList (sexpDeserialize) "(#t #f)" :: Maybe [Bool]
Just [True,False]
*Data.Generics.Serialization.SExp> withList (sexpDeserialize) "(Just \"f\\oo\")" :: Maybe (Maybe Bool)
Nothing
*Data.Generics.Serialization.SExp> withList (sexpDeserialize) "(Just \"f\\oo\")" :: Maybe (Maybe String)
Just (Just "foo")
*Data.Generics.Serialization.SExp>