
codesite-noreply:
Issue 78: Extension state http://code.google.com/p/xmonad/issues/detail?id=78
Comment #1 by daveroundy: Note, we could also make other hooks use the same mechanism as Layouts. The Layout mechanism is similar in effect to a writer monad, but with a special-case for when the state doesn't change, so we won't have to redraw the windows if a message doesn't change the layout. This approach seems to work well for Layouts, but I suppose isn't needed for other hooks (as we don't care whether or not they've changed). It also make it pretty easy to write buggy layout combinators, since it's all too easy to ignore that return value.
That's interesting!
I wonder if perhaps a custom monad would be helpful for Layouts? And whether perhaps we could use a similar approach for hooks? i.e. if we put hooks into a monad that allows them to return a modified hook, wouldn't that be enough?
If we moved to a monadic model for private state, I would imaging we'd move the layouts over to that as well. -- Don