Use Control.Exception.catch explitly to avoid warnings

The base that comes with ghc-7.6.1 no longer includes Prelude.catch;
so these modules were changed so that there is no warning for

import Prelude hiding (catch)

At the same time these changes should be compatible with older GHCs,
since the catch being has never been the one in the Prelude.
This commit is contained in:
Adam Vogt
2012-11-09 01:35:06 +00:00
parent a9911d2168
commit 3fa51ed656
11 changed files with 25 additions and 38 deletions

View File

@@ -30,10 +30,9 @@ module XMonad.Prompt.Shell
) where
import Codec.Binary.UTF8.String (encodeString)
import Control.Exception
import Control.Exception as E
import Control.Monad (forM)
import Data.List (isPrefixOf)
import Prelude hiding (catch)
import System.Directory (doesDirectoryExist, getDirectoryContents)
import System.Environment (getEnv)
import System.Posix.Files (getFileStatus, isDirectory)
@@ -111,7 +110,7 @@ commandCompletionFunction cmds str | '/' `elem` str = []
getCommands :: IO [String]
getCommands = do
p <- getEnv "PATH" `catch` econst []
p <- getEnv "PATH" `E.catch` econst []
let ds = filter (/= "") $ split ':' p
es <- forM ds $ \d -> do
exists <- doesDirectoryExist d
@@ -142,7 +141,7 @@ isSpecialChar = flip elem " &\\@\"'#?$*()[]{};"
-- In order to /set/ an environment variable (eg. combine with a prompt so you can modify @$HTTP_PROXY@ dynamically),
-- you need to use 'System.Posix.putEnv'.
env :: String -> String -> IO String
env variable fallthrough = getEnv variable `catch` econst fallthrough
env variable fallthrough = getEnv variable `E.catch` econst fallthrough
{- | Ask the shell what browser the user likes. If the user hasn't defined any
$BROWSER, defaults to returning \"firefox\", since that seems to be the most