
20 Dec
2009
20 Dec
'09
2:16 p.m.
Quoting Günther Schmidt
I have only glimpsed at the xmonad code but I don't remember seeing even a single IORef, so I am asking for your opinion: Can studying xmonad code provide me with a better solution for my problem?
xmonad uses a State monad transformer to maintain information. The upside of this is that no mutable variables are necessary -- it just passes along different copies of its state as the state needs to "change". The downside is that it is utterly impossible for two threads to share the internal state as it changes. Since most GUI code is multithreaded eventually (to keep the GUI responsive during expensive operations), I wouldn't recommend this approach... ~d