
Leo Alekseyev [2012.05.13 1923 -0400]:
Hi Norbert, Yes, my original math was kind of dodgy... Your solution seems better, but it doesn't compile for me... any ideas?
xmonad.hs:452:14: No instance for (MonadState XState ((->) (W.StackSet [Char] l3 a3 s3 sd3))) arising from a use of `gets' Possible fix: add an instance declaration for (MonadState XState ((->) (W.StackSet [Char] l3 a3 s3 sd3))) In the first argument of `(>>=)', namely `gets (tag . W.workspace . W.current . windowset)' In the expression: gets (tag . W.workspace . W.current . windowset) >>= W.greedyView . toMain In an equation for `jumpToMain': jumpToMain = gets (tag . W.workspace . W.current . windowset) >>= W.greedyView . toMain where toMain ws = [head ws]
xmonad.hs:456:17: No instance for (MonadState XState ((->) (W.StackSet [Char] l1 a1 s1 sd1))) arising from a use of `gets' Possible fix: add an instance declaration for (MonadState XState ((->) (W.StackSet [Char] l1 a1 s1 sd1))) In the first argument of `(>>=)', namely `gets (tag . W.workspace . W.current . windowset)' In the expression: gets (tag . W.workspace . W.current . windowset) >>= W.greedyView . toScratch In an equation for `jumpToScratch': jumpToScratch = gets (tag . W.workspace . W.current . windowset) >>= W.greedyView . toScratch where toScratch ws | length ws == 1 = ws ++ "SCR" | otherwise = ws
Sorry. I didn't check whether it compiles and got the type of greedyView wrong. Here's a correct (and slightly cleaner version): jumpToMain = withWindowSet (windows . W.greedyView . toMain . W.tag . W.workspace . W.current) where toMain ws = [head ws] jumpToScratch = withWindowSet (windows . W.greedyView . toScratch . W.tag . W.workspace . W.current) where toScratch ws | length ws == 1 = ws ++ "SCR" | otherwise = ws