summaryrefslogtreecommitdiffstats
path: root/MetaTile
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-09-12 22:40:05 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-09-12 22:40:05 +0200
commitdf1ed51813e3343d7421543c3bf91415b8cc10c8 (patch)
tree54dc44ae31e2a255b7e9b86ffe0c5ee344f41411 /MetaTile
parent3bf5609453485e8b20a75797994ff3b64d8c60ed (diff)
downloadmetatile-df1ed51813e3343d7421543c3bf91415b8cc10c8.tar
metatile-df1ed51813e3343d7421543c3bf91415b8cc10c8.zip
Don't hide Prelude.catch to avoid warnings with current GHC
Diffstat (limited to 'MetaTile')
-rw-r--r--MetaTile/Core.hs12
-rw-r--r--MetaTile/ManageHook.hs9
2 files changed, 11 insertions, 10 deletions
diff --git a/MetaTile/Core.hs b/MetaTile/Core.hs
index 572280b..79611fd 100644
--- a/MetaTile/Core.hs
+++ b/MetaTile/Core.hs
@@ -33,9 +33,8 @@ module MetaTile.Core (
import MetaTile.StackSet hiding (modify)
-import Prelude hiding ( catch )
import Codec.Binary.UTF8.String (encodeString)
-import Control.Exception.Extensible (catch, fromException, try, bracket, throw, finally, SomeException(..))
+import Control.Exception.Extensible (fromException, try, bracket, throw, finally, SomeException(..))
import Control.Applicative
import Control.Monad.State
import Control.Monad.Reader
@@ -57,6 +56,7 @@ import Data.List ((\\))
import Data.Maybe (isJust,fromMaybe)
import Data.Monoid
+import qualified Control.Exception.Extensible as C (catch)
import qualified Data.Map as M
@@ -200,7 +200,7 @@ catchX :: X a -> X a -> X a
catchX job errcase = do
st <- get
c <- ask
- (a, s') <- io $ runX c st job `catch` \e -> case fromException e of
+ (a, s') <- io $ runX c st job `C.catch` \e -> case fromException e of
Just x -> throw e `const` (x `asTypeOf` ExitSuccess)
_ -> do hPrint stderr e; runX c st errcase
put s'
@@ -460,7 +460,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 :: MonadIO m => IO () -> m ()
-catchIO f = io (f `catch` \(SomeException e) -> hPrint stderr e >> hFlush stderr)
+catchIO f = io (f `C.catch` \(SomeException e) -> hPrint stderr e >> hFlush stderr)
-- | spawn. Launch an external application. Specifically, it double-forks and
-- runs the 'String' you pass as a command to \/bin\/sh.
@@ -557,11 +557,11 @@ recompile force = io $ do
return ()
return (status == ExitSuccess)
else return True
- where getModTime f = catch (Just <$> getModificationTime f) (\(SomeException _) -> return Nothing)
+ where getModTime f = C.catch (Just <$> getModificationTime f) (\(SomeException _) -> return Nothing)
isSource = flip elem [".hs",".lhs",".hsc"] . takeExtension
allFiles t = do
let prep = map (t</>) . Prelude.filter (`notElem` [".",".."])
- cs <- prep <$> catch (getDirectoryContents t) (\(SomeException _) -> return [])
+ cs <- prep <$> C.catch (getDirectoryContents t) (\(SomeException _) -> return [])
ds <- filterM doesDirectoryExist cs
concat . ((cs \\ ds):) <$> mapM allFiles ds
diff --git a/MetaTile/ManageHook.hs b/MetaTile/ManageHook.hs
index f2daf9c..c7140c4 100644
--- a/MetaTile/ManageHook.hs
+++ b/MetaTile/ManageHook.hs
@@ -18,17 +18,18 @@
module MetaTile.ManageHook where
-import Prelude hiding (catch)
import MetaTile.Core
import Graphics.X11.Xlib.Extras
import Graphics.X11.Xlib (Display, Window, internAtom, wM_NAME)
-import Control.Exception.Extensible (bracket, catch, SomeException(..))
+import Control.Exception.Extensible (bracket, SomeException(..))
import Control.Monad.Reader
import Data.Maybe
import Data.Monoid
import qualified MetaTile.StackSet as W
import MetaTile.Operations (reveal)
+import qualified Control.Exception.Extensible as C (catch)
+
-- | Lift an 'X' action to a 'Query'.
liftX :: X a -> Query a
liftX = Query . lift
@@ -74,10 +75,10 @@ title = ask >>= \w -> liftX $ do
let
getProp =
(internAtom d "_NET_WM_NAME" False >>= getTextProperty d w)
- `catch` \(SomeException _) -> getTextProperty d w wM_NAME
+ `C.catch` \(SomeException _) -> getTextProperty d w wM_NAME
extract prop = do l <- wcTextPropertyToTextList d prop
return $ if null l then "" else head l
- io $ bracket getProp (xFree . tp_value) extract `catch` \(SomeException _) -> return ""
+ io $ bracket getProp (xFree . tp_value) extract `C.catch` \(SomeException _) -> return ""
-- | Return the application name.
appName :: Query String