diff options
| author | Adam Vogt <vogt.adam@gmail.com> | 2009-10-11 03:56:18 +0200 | 
|---|---|---|
| committer | Adam Vogt <vogt.adam@gmail.com> | 2009-10-11 03:56:18 +0200 | 
| commit | 638a9d5a9022e451e6eea4cc66eb1cf4d2d65f03 (patch) | |
| tree | 4b604e4f9bbb7d9c34fc24f298f34dfbf3f47e4b | |
| parent | 1fd673d50d48ee3f7a4dc86eb6488cd26d976b4f (diff) | |
| download | xmobar-638a9d5a9022e451e6eea4cc66eb1cf4d2d65f03.tar.gz xmobar-638a9d5a9022e451e6eea4cc66eb1cf4d2d65f03.tar.bz2  | |
Support for base 4 without base-3 compatibility
Ignore-this: 6846a123ade5dc1164841e62beabbf71
darcs-hash:20091011015618-1499c-f91811df4a05f6e4d236faaa5f4b4050613253e1.gz
| -rw-r--r-- | Commands.hs | 2 | ||||
| -rw-r--r-- | Plugins/Monitors/Common.hs | 4 | ||||
| -rw-r--r-- | Plugins/StdinReader.hs | 4 | ||||
| -rw-r--r-- | Xmobar.hs | 16 | ||||
| -rw-r--r-- | xmobar.cabal | 2 | 
5 files changed, 16 insertions, 12 deletions
diff --git a/Commands.hs b/Commands.hs index 9697fce..6bbe95b 100644 --- a/Commands.hs +++ b/Commands.hs @@ -67,7 +67,7 @@ instance Exec Command where                          hClose e                  case exit of                    ExitSuccess -> do -                            str <- catch (hGetLineSafe o) (\_ -> return "") +                            str <- catch (hGetLineSafe o) (\(SomeException _) -> return "")                              closeHandles                              cb str                    _ -> do closeHandles diff --git a/Plugins/Monitors/Common.hs b/Plugins/Monitors/Common.hs index 1b5cb60..7ac10c2 100644 --- a/Plugins/Monitors/Common.hs +++ b/Plugins/Monitors/Common.hs @@ -55,7 +55,7 @@ import Data.List  import Numeric  import Text.ParserCombinators.Parsec  import System.Console.GetOpt -import Control.Exception (handle) +import Control.Exception (SomeException,handle)  import Plugins  -- $monitor @@ -149,7 +149,7 @@ runM args conf action r cb = do go      where go = do              c <- conf              let ac = doArgs args action -            s <- handle (const $ return "error") $ runReaderT ac c +            s <- handle (\x -> const (return "error") $ x `asTypeOf` (undefined::SomeException)) $ runReaderT ac c              cb s              tenthSeconds r              go diff --git a/Plugins/StdinReader.hs b/Plugins/StdinReader.hs index a12b722..0c075e6 100644 --- a/Plugins/StdinReader.hs +++ b/Plugins/StdinReader.hs @@ -18,7 +18,7 @@ import Prelude hiding (catch)  import System.Posix.Process  import System.Exit  import System.IO -import Control.Exception (catch) +import Control.Exception (SomeException(..),catch)  import Plugins  data StdinReader = StdinReader @@ -26,7 +26,7 @@ data StdinReader = StdinReader  instance Exec StdinReader where      start StdinReader cb = do -        cb =<< catch (hGetLineSafe stdin) (\e -> do hPrint stderr e; return "") +        cb =<< catch (hGetLineSafe stdin) (\(SomeException e) -> do hPrint stderr e; return "")          eof <- hIsEOF stdin          if eof              then exitImmediately ExitSuccess @@ -1,3 +1,4 @@ +{-# LANGUAGE DeriveDataTypeable #-}  -----------------------------------------------------------------------------  -- |  -- Module      :  Xmobar @@ -41,7 +42,7 @@ import Control.Exception hiding (handle)  import Data.Bits  import Data.Char  import Data.Maybe(fromMaybe) - +import Data.Typeable (Typeable)  import Config  import Parsers @@ -69,12 +70,15 @@ data XConf =  runX :: XConf -> X () -> IO ()  runX xc f = runReaderT f xc +data WakeUp = WakeUp deriving (Show,Typeable) +instance Exception WakeUp +  -- | The event loop  eventLoop :: XConf -> [(Maybe ThreadId, TVar String)] -> IO ()  eventLoop xc@(XConf d _ w fs c) v = block $ do      tv <- atomically $ newTVar []      t  <- myThreadId -    ct <- forkIO (checker t tv "" `catch` \_ -> return ()) +    ct <- forkIO (checker t tv "" `catch` \(SomeException _) -> return ())      go tv ct   where      -- interrupt the drawing thread every time a var is updated @@ -84,14 +88,14 @@ eventLoop xc@(XConf d _ w fs c) v = block $ do                guard (nv /= ov)                writeTVar tvar nv                return nv -      throwDynTo t () +      throwTo t WakeUp        checker t tvar nval      -- Continuously wait for a timer interrupt or an expose event      go tv ct = do -      catchDyn (unblock $ allocaXEvent $ \e -> -                    handle tv ct =<< (nextEvent' d e >> getEvent e)) -               (\() -> runX xc (updateWin tv) >> return ()) +      catch (unblock $ allocaXEvent $ \e -> +                 handle tv ct =<< (nextEvent' d e >> getEvent e)) +            (\WakeUp -> runX xc (updateWin tv) >> return ())        go tv ct      -- event hanlder diff --git a/xmobar.cabal b/xmobar.cabal index c48ae06..0d49eda 100644 --- a/xmobar.cabal +++ b/xmobar.cabal @@ -39,7 +39,7 @@ executable xmobar              ghc-options:    -O0      if flag(small_base) -       build-depends:   base >= 3, base < 4, containers, process, old-time, old-locale, bytestring, directory +       build-depends:   base == 4.*, containers, process, old-time, old-locale, bytestring, directory      else         build-depends:   base < 3  | 
