Mousetoxin: Exceedingly verbose reimplementation of Ratpoison Troels Henriksen (
[email protected]) 29th November 2009 1 Chapter 1 Introduction This paper describes the implementation of Mousetoxin, a clone of the X11 window manager Ratpoison. Mousetoxin is implemented in Literate Haskell, and the full implementation is presented over the following pages. To quote the Ratpoison manual: Ratpoison is a simple Window Manager with no fat library dependen- cies, no fancy graphics, no window decorations, and no rodent depen- dence. It is largely modeled after GNU Screen which has done wonders in the virtual terminal market. All interaction with the window manager is done through keystrokes. Ratpoison has a prefix map to minimize the key clobbering that crip- ples EMACS and other quality pieces of software. Ratpoison was written by Shawn Betts (
[email protected]). Apart from serving as a literate example, partly for me and partly for others, of how to define a practical side-effect heavy Haskell program, Mousetoxin also serves as an experiment to answer two other questions of mine: • Can Haskell programs be written that obey common Unix principles (such as responding to SIGHUP by reloading their configuration file) without too much trouble, and without turning the entire program into an impure mess? • How feasible is it to write nontrivial programs in Literate Haskell? This is partially a test of the adequacy of available Haskell tools, partially a test of Literate Programming as a concept in itself. 2 Chapter 2 Startup logic The Main module defines the main entry point for the program when invoked, namely the function main.