aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-06-04 20:35:35 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-06-04 20:35:35 +0200
commitbda7933285d4efbd6b58eaa880259e7c5549098a (patch)
tree3081d8a9b354e67da4d6a956b247f3ee0a966a9e
parent931980c01b78001197626d013be99a5c8011417c (diff)
downloadxmonad-bda7933285d4efbd6b58eaa880259e7c5549098a.tar.gz
xmonad-bda7933285d4efbd6b58eaa880259e7c5549098a.tar.xz
xmonad-bda7933285d4efbd6b58eaa880259e7c5549098a.zip
swapUp/Down are also mirrored
darcs-hash:20070604183535-a5988-5ab9553321805a39ea9ada8aba0a4c53496eee4d.gz
-rw-r--r--StackSet.hs11
1 files changed, 5 insertions, 6 deletions
diff --git a/StackSet.hs b/StackSet.hs
index 2b6ed68..9ce1df9 100644
--- a/StackSet.hs
+++ b/StackSet.hs
@@ -278,13 +278,12 @@ focusUp' (Node t [] rs) = Node x xs [] where (x:xs) = reverse (t:rs)
focusDown = modify Empty (reverseStack . focusUp' . reverseStack)
-swapUp = modify Empty $ \c -> case c of
- Node t (l:ls) rs -> Node t ls (l:rs)
- Node t [] rs -> Node t (reverse rs) []
+swapUp = modify Empty swapUp'
-swapDown = modify Empty $ \c -> case c of
- Node t ls (r:rs) -> Node t (r:ls) rs
- Node t ls [] -> Node t [] (reverse ls)
+swapUp' (Node t (l:ls) rs) = Node t ls (l:rs)
+swapUp' (Node t [] rs) = Node t (reverse rs) []
+
+swapDown = modify Empty (reverseStack . swapUp' . reverseStack)
-- reverse a stack: up becomes down and down becomes up.
reverseStack (Node t ls rs) = Node t rs ls