aboutsummaryrefslogtreecommitdiffstats
path: root/StackSet.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-05-08 17:21:16 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-05-08 17:21:16 +0200
commitd88e56e11df1884a49237ac40b2027cc3ed673d4 (patch)
tree559e5497177a57720bd212106890a5aba6a7d0f5 /StackSet.hs
parentf4c2b23fecc863218a395d731bd18c2afd164db4 (diff)
downloadxmonad-d88e56e11df1884a49237ac40b2027cc3ed673d4.tar.gz
xmonad-d88e56e11df1884a49237ac40b2027cc3ed673d4.tar.xz
xmonad-d88e56e11df1884a49237ac40b2027cc3ed673d4.zip
Remove unsafe use of head
darcs-hash:20070508152116-a5988-16a82d62661a5ccd0a95f88ced57cd3e9df5fd67.gz
Diffstat (limited to '')
-rw-r--r--StackSet.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/StackSet.hs b/StackSet.hs
index 38baca2..e0210f1 100644
--- a/StackSet.hs
+++ b/StackSet.hs
@@ -188,7 +188,8 @@ raiseFocus k w = case M.lookup k (cache w) of
promote :: (Integral i, Ord a) => StackSet i j a -> StackSet i j a
promote w = maybe w id $ do
a <- peek w -- fail if null
- let w' = w { stacks = M.adjust (\(f, s) -> (f, swap a (head s) s)) (current w) (stacks w) }
+ (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 (?)
-- | Swap first occurences of 'a' and 'b' in list.