diff options
author | joachim.fasting <joachim.fasting@gmail.com> | 2007-06-20 13:28:05 +0200 |
---|---|---|
committer | joachim.fasting <joachim.fasting@gmail.com> | 2007-06-20 13:28:05 +0200 |
commit | ddff290f6689b3a13fe418e01c2dad8233b58488 (patch) | |
tree | 04a5c5a6608c5a0d80ea118f9c29eb89280ec0ad | |
parent | eead633562ef44712f05e0dde4ca230576749ed3 (diff) | |
download | XMonadContrib-ddff290f6689b3a13fe418e01c2dad8233b58488.tar.gz XMonadContrib-ddff290f6689b3a13fe418e01c2dad8233b58488.tar.xz XMonadContrib-ddff290f6689b3a13fe418e01c2dad8233b58488.zip |
Combo.hs: use case instead of non-standard pattern matching.
Also uses fmap/maybe instead of do/case, which makes the code look a little
cleaner (imo).
Please note that I've only been able to test this briefly, but it seems to be
working like it's supposed to.
darcs-hash:20070620112805-ea16c-d246e45889110c7f28da80adbcfc968139f77130.gz
Diffstat (limited to '')
-rw-r--r-- | Combo.hs | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -48,13 +48,10 @@ combo origls super = Layout { doLayout = \r s -> arrange r (integrate s), modify (map differentiate $ wss (take (length rs) $ map snd origls) origws) return $ concat out - message m | Just UnDoLayout <- fromMessage m = - do (super':ls') <- broadcastPrivate UnDoLayout (super:map fst origls) - return $ Just $ combo (zip ls' $ map snd origls) super' - message m = do msuper' <- modifyLayout super m - case msuper' of - Nothing -> return Nothing - Just super' -> return $ Just $ combo origls super' + message m = case fromMessage m of + Just UnDoLayout -> fmap (\(super':ls') -> Just $ combo (zip ls' $ map snd origls) super') + (broadcastPrivate UnDoLayout (super:map fst origls)) + _ -> fmap (maybe Nothing (Just . combo origls)) (modifyLayout super m) broadcastPrivate :: Message a => a -> [Layout b] -> X [Layout b] broadcastPrivate a ol = mapM f ol |