Beginner problem with XMonad and appending to a list rather than prefixing

XMonad Community, After all this time, I'm still just a beginner with XMonad. I only know Haskell through XMonad, and I wouldn't say I know it well. I learn just enough to get my XMonad configuration to work, then don't return to it for a while. I'm trying to make a minor change to my XMonad file, where a new workspace is appended to the list rather than prefixed like I have now, but I can't seem to figure out the code to do it. Here's the relevant details of what I have: import XMonad.Actions.DynamicWorkspaces as DW import qualified XMonad.Util.ExtensibleState as XS import Control.Applicative filterWorkspaces :: [WorkspaceId] -> [WindowSpace] -> [WindowSpace] filterWorkspaces ws = filter (\(W.Workspace tag _ _) -> tag `elem` ws) -- xScreen are the type classes which hold the workspace name lists newtype LeftScreen = LeftScreen {getLeftScreen :: [WorkspaceId]} deriving (Typeable,Read,Show) instance ExtensionClass LeftScreen where initialValue = LeftScreen [] extensionType = PersistentExtension newtype RightScreen = RightScreen {getRightScreen :: [WorkspaceId]} deriving (Typeable,Read,Show) instance ExtensionClass RightScreen where initialValue = RightScreen [] extensionType = PersistentExtension -- snip -- main = do dbus <- D.connectSession getWellKnownName dbus; xmonad $ xfceConfig { workspaces = ["sh","sb","of","wc","ws","wb","cht"] , terminal = "urxvtc" -- Goodbye, my sweet, sweet, sloppy focus , focusFollowsMouse = False , manageHook = manageDocks <+> myManageHook -- <+> manageHook defaultConfig , layoutHook = avoidStruts $ onWorkspace "gimp" gimp $ layoutH , logHook = dynamicLogWithPP (ppL dbus) >> dynamicLogWithPP (ppR dbus) >> fadeHook , borderWidth = 1 , normalBorderColor = "#333333" , focusedBorderColor = "#CCCC00" , modMask = winKey , startupHook = setWMName "LG3D" } `additionalKeys` myKeys myKeys = [ -- snip -- Here's what I want to change , ((winKey , xK_m) ,DW.withWorkspace myXPConfigNew $ \wk -> do sc <- screenBy 0 if sc == 0 then XS.modifyf $ LeftScreen . (wk :) . getLeftScreen -- prefix left list with new workspace --then XS.modify $ LeftScreen . getLeftScreen ++[wk] -- My first attempt at appending the workspace else XS.modify $ RightScreen . (wk :) . getRightScreen -- prefix right list with new workspace --else XS.modify $ RightScreen . (wk ++) . getRightScreen -- another attempt windows $ W.view wk) Normally I'd ask on #xmonad@irc.freenode.net, but I haven't had time to get on there. I'm sure this demonstrates my lack of knowledge of XMonad and Haskell in general, hopefully you can help. Thanks in advance, Trey Blancher trey@blancher.net

On Thu, May 07, 2015 at 08:23:41AM -0400, Trey Blancher wrote:
I'm trying to make a minor change to my XMonad file, where a new workspace is appended to the list rather than prefixed like I have now, but I can't seem to figure out the code to do it. Here's the relevant details of what I have:
[..]
almost! then XS.modify $ LeftScreen . getLeftScreen . (++ [wk]) ^-- this should work. Haskell is a fun and useful language, if you desire you can learn it by reading http://learnyouahaskell.com/

On Thu, May 7, 2015 at 10:27 AM, Francesco Ariis
then XS.modify >nbsp; LeftScreen . getLeftScreen . (++ [wk])
Actually, not quite. then XS.modify $ LeftScreen . (++ [wk]) . getLeftScreen (they also asked in IRC and I answered it there, for the record) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
participants (3)
-
Brandon Allbery
-
Francesco Ariis
-
Trey Blancher