updateStatusBars' :: DynamicStatusBar -> DynamicStatusBarPartialCleanup -> X ()
updateStatusBars' sb cleanup = do
  (dsbInfoScreens, dsbInfoHandles) <- XS.get >>= return . unzip . dsbInfo
  screens <- getScreens
  when (screens /= dsbInfoScreens) $ do
      let oldInfo = zip dsbInfoScreens dsbInfoHandles
      let (infoToKeep, infoToClose) = partition (flip elem screens . fst) oldInfo
      newInfo <- liftIO $ do
          mapM_ hClose $ map snd infoToClose
          mapM_ cleanup $ map fst infoToClose
          let newScreens = screens \\ dsbInfoScreens
          newHandles <- mapM sb newScreens
          return $ zip newScreens newHandles
      XS.put . DynStatusBarInfo $ infoToKeep ++ newInfo

-----------------------------------------------------------------------------
-- The following code is from adamvo's xmonad.hs file.
-- http://www.haskell.org/haskellwiki/Xmonad/Config_archive/adamvo%27s_xmonad.hs
updateStatusBars' :: DynamicStatusBar -> DynamicStatusBarPartialCleanup -> X ()
updateStatusBars' sb cleanup = do
  (dsbInfoScreens, dsbInfoHandles) <- XS.get >>= return . unzip . dsbInfo
  screens <- getScreens
  when (screens /= dsbInfoScreens) $ do
      let oldInfo = zip dsbInfoScreens dsbInfoHandles
      let (infoToKeep, infoToClose) = partition (flip elem screens . fst) oldInfo
      newInfo <- liftIO $ do
          mapM_ hClose $ map snd infoToClose
          mapM_ cleanup $ map fst infoToClose
          let newScreens = screens \\ dsbInfoScreens
          newHandles <- mapM sb newScreens
          return $ zip newScreens newHandles
      XS.put . DynStatusBarInfo $ infoToKeep ++ newInfo

-----------------------------------------------------------------------------
-- The following code is from adamvo's xmonad.hs file.
-- http://www.haskell.org/haskellwiki/Xmonad/Config_archive/adamvo%27s_xmonad.hs
updateStatusBars' sb cleanup = do
  (dsbInfoScreens, dsbInfoHandles) <- XS.get >>= return . unzip . dsbInfo
  screens <- getScreens
  when (screens /= dsbInfoScreens) $ do
      let oldInfo = zip dsbInfoScreens dsbInfoHandles
      let (infoToKeep, infoToClose) = partition (flip elem screens . fst) oldInfo
      newInfo <- liftIO $ do
          mapM_ hClose $ map snd infoToClose
          mapM_ cleanup $ map fst infoToClose
          let newScreens = screens \\ dsbInfoScreens
          newHandles <- mapM sb newScreens
          return $ zip newScreens newHandles
      XS.put . DynStatusBarInfo $ infoToKeep ++ newInfo

-----------------------------------------------------------------------------
-- The following code is from adamvo's xmonad.hs file.
-- http://www.haskell.org/haskellwiki/Xmonad/Config_archive/adamvo%27s_xmonad.hs