summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-10-08 00:02:05 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-10-08 00:02:05 +0200
commit44f99f3ed3a6af5a2289765fadf4df29887db5c2 (patch)
tree43c779aefe8828355dfbd8399f67af10b2186808 /src
parentb24a91af8d6a1f7b38012092ee786895b8b6a318 (diff)
downloadxmobar-44f99f3ed3a6af5a2289765fadf4df29887db5c2.tar.gz
xmobar-44f99f3ed3a6af5a2289765fadf4df29887db5c2.tar.bz2
Fixes for warnings reported in github issue #71
Diffstat (limited to 'src')
-rw-r--r--src/Commands.hs14
-rw-r--r--src/MinXft.hsc2
-rw-r--r--src/Plugins/MBox.hs6
-rw-r--r--src/Plugins/Monitors.hs5
-rw-r--r--src/Plugins/Monitors/CoreCommon.hs2
-rw-r--r--src/Plugins/StdinReader.hs8
-rw-r--r--src/Window.hs2
-rw-r--r--src/Xmobar.hs15
8 files changed, 27 insertions, 27 deletions
diff --git a/src/Commands.hs b/src/Commands.hs
index b501022..a4ab5ed 100644
--- a/src/Commands.hs
+++ b/src/Commands.hs
@@ -23,9 +23,9 @@ module Commands
, tenthSeconds
) where
-import Prelude hiding (catch)
+import Prelude
import Control.Concurrent
-import Control.Exception
+import Control.Exception (handle, SomeException(..))
import Data.Char
import System.Process
import System.Exit
@@ -65,12 +65,12 @@ instance Exec Command where
(i,o,e,p) <- runInteractiveCommand (unwords (prog:args))
exit <- waitForProcess p
let closeHandles = hClose o >> hClose i >> hClose e
+ getL = handle (\(SomeException _) -> return "")
+ (hGetLineSafe o)
case exit of
- ExitSuccess -> do
- str <- catch (hGetLineSafe o)
- (\(SomeException _) -> return "")
- closeHandles
- cb str
+ ExitSuccess -> do str <- getL
+ closeHandles
+ cb str
_ -> do closeHandles
cb $ "Could not execute command " ++ prog
diff --git a/src/MinXft.hsc b/src/MinXft.hsc
index 478b94a..327e95e 100644
--- a/src/MinXft.hsc
+++ b/src/MinXft.hsc
@@ -20,7 +20,7 @@
------------------------------------------------------------------------------
module MinXft ( AXftColor
- , AXftDraw
+ , AXftDraw (..)
, AXftFont
, mallocAXftColor
, freeAXftColor
diff --git a/src/Plugins/MBox.hs b/src/Plugins/MBox.hs
index 65a8bb3..c4335f7 100644
--- a/src/Plugins/MBox.hs
+++ b/src/Plugins/MBox.hs
@@ -14,13 +14,13 @@
module Plugins.MBox (MBox(..)) where
-import Prelude hiding (catch)
+import Prelude
import Plugins
import Plugins.Utils (changeLoop, expandHome)
import Control.Monad (when)
import Control.Concurrent.STM
-import Control.Exception (SomeException, handle, evaluate)
+import Control.Exception (SomeException (..), handle, evaluate)
import System.Console.GetOpt
import System.Directory (doesFileExist)
@@ -99,7 +99,7 @@ showC u m n c =
countMails :: FilePath -> IO Int
countMails f =
- handle ((\_ -> evaluate 0) :: SomeException -> IO Int)
+ handle (\(SomeException _) -> evaluate 0)
(do txt <- B.readFile f
evaluate $! length . filter (B.isPrefixOf from) . B.lines $ txt)
where from = B.pack "From "
diff --git a/src/Plugins/Monitors.hs b/src/Plugins/Monitors.hs
index 009da68..8d5ac35 100644
--- a/src/Plugins/Monitors.hs
+++ b/src/Plugins/Monitors.hs
@@ -3,7 +3,7 @@
-----------------------------------------------------------------------------
-- |
-- Module : Xmobar.Plugins.Monitors
--- Copyright : (c) 2010, 2011 Jose Antonio Ortega Ruiz
+-- Copyright : (c) 2010, 2011, 2012 Jose Antonio Ortega Ruiz
-- (c) 2007-10 Andrea Rossato
-- License : BSD-style (see LICENSE)
--
@@ -19,7 +19,7 @@ module Plugins.Monitors where
import Plugins
-import Plugins.Monitors.Common ( runM, runMB )
+import Plugins.Monitors.Common (runM)
import Plugins.Monitors.Weather
import Plugins.Monitors.Net
import Plugins.Monitors.Mem
@@ -40,6 +40,7 @@ import Plugins.Monitors.Wireless
#endif
#ifdef LIBMPD
import Plugins.Monitors.MPD
+import Plugins.Monitors.Common (runMB)
#endif
#ifdef ALSA
import Plugins.Monitors.Volume
diff --git a/src/Plugins/Monitors/CoreCommon.hs b/src/Plugins/Monitors/CoreCommon.hs
index a18697f..c7fb7d5 100644
--- a/src/Plugins/Monitors/CoreCommon.hs
+++ b/src/Plugins/Monitors/CoreCommon.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE PatternGuards, CPP #-}
+{-# LANGUAGE PatternGuards #-}
-----------------------------------------------------------------------------
-- |
diff --git a/src/Plugins/StdinReader.hs b/src/Plugins/StdinReader.hs
index 935d76a..fddd0bc 100644
--- a/src/Plugins/StdinReader.hs
+++ b/src/Plugins/StdinReader.hs
@@ -14,11 +14,11 @@
module Plugins.StdinReader where
-import Prelude hiding (catch)
+import Prelude
import System.Posix.Process
import System.Exit
import System.IO
-import Control.Exception (SomeException(..),catch)
+import Control.Exception (SomeException(..), handle)
import Plugins
data StdinReader = StdinReader
@@ -26,8 +26,8 @@ data StdinReader = StdinReader
instance Exec StdinReader where
start StdinReader cb = do
- cb =<< catch (hGetLineSafe stdin)
- (\(SomeException e) -> do hPrint stderr e; return "")
+ cb =<< handle (\(SomeException e) -> do hPrint stderr e; return "")
+ (hGetLineSafe stdin)
eof <- hIsEOF stdin
if eof
then exitImmediately ExitSuccess
diff --git a/src/Window.hs b/src/Window.hs
index 4678046..e9a67cf 100644
--- a/src/Window.hs
+++ b/src/Window.hs
@@ -15,7 +15,7 @@
module Window where
-import Prelude hiding (catch)
+import Prelude
import Control.Monad (when)
import Graphics.X11.Xlib hiding (textExtents, textWidth)
import Graphics.X11.Xlib.Extras
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index f8db6a5..5fc0cd4 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -29,7 +29,7 @@ module Xmobar
, drawInWin, printStrings
) where
-import Prelude hiding (catch)
+import Prelude
import Graphics.X11.Xlib hiding (textExtents, textWidth)
import Graphics.X11.Xlib.Extras
import Graphics.X11.Xinerama
@@ -39,7 +39,7 @@ import Control.Arrow ((&&&))
import Control.Monad.Reader
import Control.Concurrent
import Control.Concurrent.STM
-import Control.Exception (catch, SomeException(..))
+import Control.Exception (handle, SomeException(..))
import Data.Bits
import Config
@@ -86,23 +86,22 @@ startLoop xcfg@(XConf _ _ w _ _) sig vs = do
xftInitFtLibrary
#endif
tv <- atomically $ newTVar []
- _ <- forkIO (checker tv [] vs sig `catch`
- \(SomeException _) -> void (putStrLn "Thread checker failed"))
+ _ <- forkIO (handle (handler "checker") (checker tv [] vs sig))
#ifdef THREADED_RUNTIME
- _ <- forkOS (eventer sig `catch`
+ _ <- forkOS (handle (handler "eventer") (eventer sig))
#else
- _ <- forkIO (eventer sig `catch`
+ _ <- forkIO (handle (handler "eventer") (eventer sig))
#endif
- \(SomeException _) -> void (putStrLn "Thread eventer failed"))
#ifdef DBUS
runIPC sig
#endif
eventLoop tv xcfg sig
where
+ handler thing (SomeException _) =
+ putStrLn ("Thread " ++ thing ++ " failed") >> return ()
-- Reacts on events from X
eventer signal =
allocaXEvent $ \e -> do
-
dpy <- openDisplay ""
xrrSelectInput dpy (defaultRootWindow dpy) rrScreenChangeNotifyMask
selectInput dpy w (exposureMask .|. structureNotifyMask)