[Xmonad] xmonad is a zipper
Neil Mitchell
ndmitchell at gmail.com
Wed May 16 09:58:12 EDT 2007
Hi
And once again, firing Catch (google:catch haskell) off on this code:
* new calls error, not a big surprise that this makes it incomplete
* view also calls error
* swap calls tail, which isn't safe unless you know some seriously
deep stuff about index, and keep a detailed mapping between elements.
The basic problem is that Catch can't know that successive calls to
Map.lookup with the same key give the same results. You can probably
eliminate this by only performing one lookup, which is also faster.
* delete and focusWindow both call focus, which is incomplete. Both
feature very similar code, and could do with abstracting out. The
basic pattern is:
focus (stack (current s))
which is unsafe - since stack may return Empty, for which focus is incomplete.
* new relies on the Integral type having sensible semantics, if you
pass Int or Integer its fine (machine checked), but if you create a
crazy type, make it an instance of Integral then [0..n-1] may generate
no elements, and your (h:t) match will fail.
All the rest of the program is safe, including the partial 'with'
function, as specifically annotated by dons to check.
Thanks
Neil
More information about the Xmonad
mailing list