From 39f010d82d0292d9417a06abaf91dabb43ea3ef4 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Sun, 31 Jul 2011 19:08:50 +0200 Subject: GHC 7 compat Ignore-this: 17a43a709e70ebccc925e016d7057399 * true error: more modules export foldl/foldl'/foldr, so explicitly use the Data.Foldable one * -Werror error: transition from Control.OldException to Control.Exception, assuming everything was IOException darcs-hash:20110731170850-76d51-71271524485f6d10f84521f271182bea5085d400.gz --- XMonad/Prompt/Shell.hs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'XMonad/Prompt/Shell.hs') diff --git a/XMonad/Prompt/Shell.hs b/XMonad/Prompt/Shell.hs index a8ddff4..9ed9293 100644 --- a/XMonad/Prompt/Shell.hs +++ b/XMonad/Prompt/Shell.hs @@ -25,8 +25,10 @@ module XMonad.Prompt.Shell ) where import Codec.Binary.UTF8.String (decodeString, encodeString) +import Control.Exception 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) @@ -35,6 +37,9 @@ import XMonad.Util.Run import XMonad hiding (config) import XMonad.Prompt +econst :: Monad m => a -> IOException -> m a +econst = const . return + {- $usage 1. In your @~\/.xmonad\/xmonad.hs@: @@ -97,7 +102,7 @@ commandCompletionFunction cmds str | '/' `elem` str = [] getCommands :: IO [String] getCommands = do - p <- getEnv "PATH" `catch` const (return []) + p <- getEnv "PATH" `catch` econst [] let ds = filter (/= "") $ split ':' p es <- forM ds $ \d -> do exists <- doesDirectoryExist d @@ -126,7 +131,7 @@ isSpecialChar = flip elem " &\\@\"'#?$*()[]{};" -- | Ask the shell environment for env :: String -> String -> IO String -env variable fallthrough = getEnv variable `catch` \_ -> return fallthrough +env variable fallthrough = getEnv variable `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 -- cgit v1.2.3