
On 2008.06.03 09:42:42 -0500, Lanny Ripple
I wasn't thrilled with it either but wasn't sure where to put actionMaybe (the name I had for it). In WindowGo and import into CopyWindow? In a new Util module and import into both?
For now I would stick it in WindowGo, and import it. One function isn't enough to make a module if there is no compelling reason to. (I mean, if importing WindowGo added some huge dependencies to CopyWindow, sure, but they're both in XMC and depend on the same stuff.)
There's also the problem that
focus :: win -> X ()
(windows . copyWindow) :: win -> ws -> X()
where 'ws' has to be discovered in actionMaybe. So
raiseMaybe = actionMaybe (focus . const) copyMaybe = actionMaybe (windows . copyWindow)
actionMaybe = (Window -> Workspace -> X ()) -> Query Bool -> X () actionMaybe doWin f thatUserQuery = withWindowSet $ \x -> do maybeResult <- filterM (runQuery thatUserQuery) (allWindows s) case maybeResult of [] -> f (win:_) -> doWin win (currentTag s)
which I don't know if I'm happy about.
Anyway happy to make the changes if I can get some advice on where to put the abstracted (hoisted?, common?) code.
-ljr
I think it's a good idea to do the abstraction. Right now there are only two users, yes, but I suspect sooner or later, someone will want a 'deleteMaybe', a 'moveMaybe'... Actually, if we get as many as 4 users, it might make sense to copy it over into XMonad's source whereever the Query monad stuff lives. It would've proven its chops as a utility function, after all. -- gwern Ronco psyops BX Pod SUR House SO13 BBE Blowpipe Satellite