MassD/bson — pull request #6 by msimon (2013-07-26 19:11:44+00:00)
Title: Oasis setup, Bson Syntax extension

Hi,
I first set up a oasis config file, genereate Makefile, _tags, ect...
Then I add bson_ext. A 'deriving' syntax extension to simplify the creation of bson document/element. You can find an example in the test folder.

It create a module by type, with two function:
module Bson_ext_$TYPE_NAME$ =
sig
to_bson: 'a -> bson element
from_bson: bson element -> 'a
end

Also it create another module:
module Bson_utils_$TYPE_NAME$ =
sig
to_bson: 'a -> bson document
from_bson: bson document -> 'a
end

Bson_ext depend on deriving-ocsigen and deriving-ocsigen.syntax. I use those one since they are package in OPAM, and I didn't have the basic deriving installed. Feel free to change this in _oasis file, and then run oasis setup.

I also had too make the function 'all_element' available for my extension (in bson.mli)

All the change in bson.ml are space character before a new line, my emacs remove it itself.

Cheers!