heads up: xmonad zipper patch pushed

I've pushed the reimplementation of xmonad as a zipper. This affects the StackSet module entirely (completely rewritten), and much of Operations.hs. Additional, a bit of the StackSet api has changed names (documented in the file), new QC properties have been added., and the code has shrunk by 55 lines: Code Comments Before: Operations.hs 194 139 Main.hs 110 88 StackSet.hs 101 132 XMonad.hs 57 89 Config.hs 53 136 TOTAL: 515 584 After: Operations.hs 152 149 Main.hs 97 71 StackSet.hs 87 272 XMonad.hs 71 102 Config.hs 53 136 TOTAL: 460 730 A few words of warning: * This likely breaks some of the contrib modules, due to api changes. Fixing that will happen over the next few days. * Also, the changes that affect Xinerama are untested, so Jason, if you can check that out. In particular, I believe focusWindow needs to check for visible workspaces, not just the current workspace. * Finally, Neil, if you want to rerun the Catch verifier on StackSet, that would be neat. I think I've followed up on the changes you suggested earlier in the week. Here's a sample of the changes to the logic core in StackSet, to make us feel happy. Old, table-based implementation of 'swap/promote': -promote w = maybe w id $ do - a <- peek w -- fail if null - (f, xs@(x:_)) <- M.lookup (current w) (stacks w) - let w' = w { stacks = M.insert (current w) (f, swap a x xs) (stacks w) } - return $ insert a (current w) w' -- and maintain focus (?) - where - swap a b xs = maybe xs id $ do - ai <- L.elemIndex a xs - bi <- L.elemIndex b xs - return . insertAt bi a . insertAt ai b $ xs - where insertAt n x ys = as ++ x : drop 1 bs - where (as,bs) = splitAt n ys New implementation: +swap = modify Empty $ \c -> case c of + Node _ [] _ -> c -- already master. + Node t ls rs -> Node t [] (ys ++ x : rs) where (x:ys) = reverse ls Cute eh? Similar effects for insert/rotate and friends. Window managers should be zippers. -- Don

Hi Dons
* Finally, Neil, if you want to rerun the Catch verifier on StackSet, that would be neat. I think I've followed up on the changes you suggested earlier in the week.
A couple of issues remain: * You export some incomplete record selectors: "focus", "left" and "right". * You export "with", which I thought was meant to be internal? I've checked it even so. * "new" and "view" both call error. To gain Catch safety you can mark these errors as known by defining: abort x = error x Then calling abort, rather than error. The Safe library [http://www-users.cs.york.ac.uk/~ndm/safe/] defines such an abort - but its probably easier if you just define one yourself. Everything else passes fine with Catch. You may now use the "checked with Catch" logo on the XMonad website, if you wish: http://www.cs.york.ac.uk/fp/darcs/catch/extra/catch.png Thanks Neil

ndmitchell:
Hi Dons
* Finally, Neil, if you want to rerun the Catch verifier on StackSet, that would be neat. I think I've followed up on the changes you suggested earlier in the week.
A couple of issues remain:
* You export some incomplete record selectors: "focus", "left" and "right".
Fixed
* You export "with", which I thought was meant to be internal? I've checked it even so.
Fixed
* "new" and "view" both call error. To gain Catch safety you can mark these errors as known by defining:
abort x = error x
This means that Catch will pass the code as is, as a flagged error?
Then calling abort, rather than error. The Safe library [http://www-users.cs.york.ac.uk/~ndm/safe/] defines such an abort - but its probably easier if you just define one yourself.
Everything else passes fine with Catch.
Great!
You may now use the "checked with Catch" logo on the XMonad website, if you wish:
Will do. -- Don

Hi
* You export some incomplete record selectors: "focus", "left" and "right".
Does (..) not export them still?
* "new" and "view" both call error. To gain Catch safety you can mark these errors as known by defining:
abort x = error x
This means that Catch will pass the code as is, as a flagged error?
Currently it means nothing, but I intend to fix that in the next few days. The intention is that if you call abort Catch will give you a warning "this function may raise the abort error blah", but Catch will still report success on the whole file. Thanks Neil

ndmitchell:
Hi
* You export some incomplete record selectors: "focus", "left" and "right".
Does (..) not export them still?
Yeah. I need to work out which ones we need. I suspect focus, left and right can be avoided, in favour of peek.
* "new" and "view" both call error. To gain Catch safety you can mark these errors as known by defining:
abort x = error x
This means that Catch will pass the code as is, as a flagged error?
Currently it means nothing, but I intend to fix that in the next few days. The intention is that if you call abort Catch will give you a warning "this function may raise the abort error blah", but Catch will still report success on the whole file.
Ah ok. -- Don

Donald Bruce Stewart on 2007-05-20 17:22:58 +1000:
* Also, the changes that affect Xinerama are untested, so Jason, if you can check that out. In particular, I believe focusWindow needs to check for visible workspaces, not just the current workspace.
The zipper as used does breaks Xinerama support. I have two monitors; when xmonad starts, the screen accessible with 'w' contains workspace 1, the screen accessible with 'e' contains workspace 2. If I create an xterm, it pops up on workspace 1 as expected. Under pre-zipper code, if I wanted to create an xterm in workspace 2, I would hit mod-e to switch to the workspace on the other screen. When I try this with the zipper code, the contents of screen 'w' disappear. I can create the xterm, but now, if I want to switch back to screen 'w' from screen 'e', the contents of screen 'e' disappear.

On Sun, 20 May 2007 11:05:31 -0400
Alec Berryman
Donald Bruce Stewart on 2007-05-20 17:22:58 +1000:
* Also, the changes that affect Xinerama are untested, so Jason, if you can check that out. In particular, I believe focusWindow needs to check for visible workspaces, not just the current workspace.
The zipper as used does breaks Xinerama support.
I have two monitors; when xmonad starts, the screen accessible with 'w' contains workspace 1, the screen accessible with 'e' contains workspace 2. If I create an xterm, it pops up on workspace 1 as expected.
Should be fixed now, thanks to Jason. Cheers, Spencer Janssen
participants (4)
-
Alec Berryman
-
dons@cse.unsw.edu.au
-
Neil Mitchell
-
Spencer Janssen