aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-04-30 04:53:19 +0200
committerDon Stewart <dons@cse.unsw.edu.au>2007-04-30 04:53:19 +0200
commit15bf543b1e4ef2fd5cec79ff7aa8d93f931e8f4a (patch)
tree9f01bb51a329a5cc8f055688f5d3e87e4cbc6d6d
parente54b15d63848461d1389b8eb143cf6af14b72ecb (diff)
downloadxmonad-15bf543b1e4ef2fd5cec79ff7aa8d93f931e8f4a.tar.gz
xmonad-15bf543b1e4ef2fd5cec79ff7aa8d93f931e8f4a.tar.xz
xmonad-15bf543b1e4ef2fd5cec79ff7aa8d93f931e8f4a.zip
clean 'delete' a little
darcs-hash:20070430025319-9c5c1-e9f7308996d1400c1abd42d2d5f6ef30b8f01c06.gz
-rw-r--r--StackSet.hs12
1 files changed, 5 insertions, 7 deletions
diff --git a/StackSet.hs b/StackSet.hs
index a480792..f21306f 100644
--- a/StackSet.hs
+++ b/StackSet.hs
@@ -169,14 +169,12 @@ insert k n old = new { cache = M.insert k n (cache new)
-- This can be used to ensure that a given element is not managed elsewhere.
-- If the element doesn't exist, the original StackSet is returned unmodified.
delete :: (Integral i, Ord a) => a -> StackSet i j a -> StackSet i j a
-delete k w = maybe w tweak (M.lookup k (cache w))
+delete k w = maybe w del (M.lookup k (cache w))
where
- tweak i = w { cache = M.delete k (cache w)
- , stacks = M.adjust (L.delete k) i (stacks w)
- , focus = M.update (\k' -> if k == k' then elemAfter k (stacks w M.! i)
- else Just k') i
- (focus w)
- }
+ del i = w { cache = M.delete k (cache w)
+ , stacks = M.adjust (L.delete k) i (stacks w)
+ , focus = M.update (\k' -> if k == k' then elemAfter k (stacks w M.! i)
+ else Just k') i (focus w) }
-- | /O(log n)/. If the given window is contained in a workspace, make it the
-- focused window of that workspace, and make that workspace the current one.