ANN: protocol-buffers (bootstrap works) version 0.1.0
Chris Kuklewicz
haskell at list.mightyreason.com
Thu Aug 14 06:10:41 EDT 2008
Announcing the Haskell version of protocol-buffers, version 0.1.0. This is
still pre-beta.
The darcs repository is at
http://darcs.haskell.org/packages/protocol-buffers/
There is an (untested) tarball at
http://hackage.haskell.org/cgi-bin/hackage-scripts/package/protocol-buffers
The original google version of protocol buffers is at
http://code.google.com/apis/protocolbuffers/docs/overview.html
After tinkering for a while, the Haskell protocol-buffers package is now able to
bootstrap the descriptor.proto file from the google source.
The lexer & parser can handle the full unittest.proto from the google source.
The Lexer.hs module is created from "Lexer.x" by the Alex program (I am using
Alex version 2.2).
The basics for the wire protocol are there, but have not been tested and need a
small high level API.
There is no actual program yet. The closest thing to an entry point is the
"Text.ProtocolBuffers.Bootstrap" module which shows how I generated the modules
from descriptor.proto.
Notes on the current implementation:
The messages become Haskell record data types with 1 constructor and an
individual module for namespace management.
The fields become Haskell record names,
optional fields are wrapped in Maybe
repeated fields are wrapped in Seq (from Data.Sequence)
Enumerations become Haskell data types with an individual module for
namespace management.
The enum values become different Haskell constructors for the type (no arguments)
Wire protocol implemented on top of binary Get and Put monads (to and from
Lazy ByteString)
Some reflection is possible (via type classes)
Todo:
Make the Lexer check that TYPE_STRING default values are valid UTF-8 (easy).
The handling of default string/bytes in Gen.hs is not quite right and will
need to be fixed (easy).
The next things to add are full support for TYPE_GROUP and then support for
extensions (easy and medium).
Check that the Lexer properly handles /* block style */ comments.
Test the wire protocol versus google's implementation.
I have not even started looking at serivice/method/rpc support.
Cheers,
Chris Kuklewicz
More information about the Libraries
mailing list