summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2008-01-28 06:46:51 +0100
committerSpencer Janssen <sjanssen@cse.unl.edu>2008-01-28 06:46:51 +0100
commit3f73082efaaccedd6854f33f766e2e3b22009c2c (patch)
treea88bc56eaa0410e890bcb25a313665b2ce3ae23e
parentc4846b536c9da5d419c82f4057813564df246a71 (diff)
downloadmetatile-3f73082efaaccedd6854f33f766e2e3b22009c2c.tar
metatile-3f73082efaaccedd6854f33f766e2e3b22009c2c.zip
Generalize the type of catchIO, use it in Main.hs
darcs-hash:20080128054651-a5988-263142a13a2bb7dbe0d0084456fbe29b7b603e47
-rw-r--r--Main.hs3
-rw-r--r--XMonad/Core.hs2
2 files changed, 2 insertions, 3 deletions
diff --git a/Main.hs b/Main.hs
index 2be135c..00e8d59 100644
--- a/Main.hs
+++ b/Main.hs
@@ -16,7 +16,6 @@ module Main (main) where
import XMonad
-import Control.Exception (handle)
import System.IO
import System.Info
import System.Environment
@@ -31,7 +30,7 @@ import qualified Properties
main :: IO ()
main = do
args <- getArgs
- let launch = handle (hPrint stderr) buildLaunch >> xmonad defaultConfig
+ let launch = catchIO buildLaunch >> xmonad defaultConfig
case args of
[] -> launch
["--resume", _] -> launch
diff --git a/XMonad/Core.hs b/XMonad/Core.hs
index df9c4b7..8dfa91f 100644
--- a/XMonad/Core.hs
+++ b/XMonad/Core.hs
@@ -291,7 +291,7 @@ io = liftIO
-- | Lift an IO action into the X monad. If the action results in an IO
-- exception, log the exception to stderr and continue normal execution.
-catchIO :: IO () -> X ()
+catchIO :: MonadIO m => IO () -> m ()
catchIO f = io (f `catch` \e -> hPrint stderr e >> hFlush stderr)
-- | spawn. Launch an external application