[Haskell] Haskell Xlib bindings

Dimitry Golubovsky golubovsky at gmail.com
Mon Feb 5 12:00:31 EST 2007


This message does not answer the original question, but may be useful
if anyone really wants to work on the X protocol interface to Haskell.

Just adding from my past experience.

I had a (experimental, unfinished, and most likely it never will be
finished) project to bind directly to the X11 protocol rather than to
Xlib, and thus to have full access to all information exchanged
between the client and server sides (the original question was about
Xlib hiding some info).

The protocol transport layer binding was done using FFIPKG, and the
working directory is here:


All those modules with cryptic names are results of hsffig parsing C
data structures' definitions from X.h and Xproto.h

Some example usage is in the HSX11 subdirectory. Hskell files in the
main directory were my attempts to model the evilwm window manager as
an example, but because of lack of time I never got any far on that

In HSX11 there is a definition of the Transceivable class which does
binary serialization/deserialization of protocol packets, and also a
module XAuthority which implements the magic cookie protocol. Also
some generic code for few X11 requests and responses.

Finally, I was able to display a window with some cyrillic characters
in it (to show that Unicode works).

The largest problem was to obtain automatic serialization code for all
those packet structures which might be most likely done with Template
Haskell, but some functionality was missing in it back then.

Dimitry Golubovsky

Anywhere on the Web

More information about the Haskell mailing list