Hobby: a Haskell Wrapper for Obby

Obby is a C++ library (libobby) that provides synced document buffers – essentially, buffers that can be shared between multiple clients over a network, in such a way that changes to the buffer made by one client are immediately propagated to all of the other clients. It is used by the extremely cool collaborative editor Gobby.

Hobby is an attempt to create a pure C API for libobby, and to make the functions in that API available to Haskell programs via Haskell’s FFI. It uses c2hs to generate Haskell bindings based on the header files of C code. If you have darcs, you can obtain the current source of Hobby via

darcs get http://www.codepoetics.com/hobby

The code currently in the repo simply sets up and tests a toolchain that consists, at the moment, of GNU make, g++, sed, c2hs and ghc. Makefiles control the build; g++ creates the C API object files; sed converts C++ header files to C header files by stripping out the “extern C” declarations; c2hs creates the Haskell FFI bindings for the C header files, and ghc compiles them.

The next stage in the project is to wrap as much of the ClientBuffer object code as possible, and see if we can get some working Haskell code to connect to a running Gobby session.

Leave a Reply