aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Prompt/Shell.hs
diff options
context:
space:
mode:
authorDaniel Wagner <daniel@wagner-home.com>2011-07-31 19:08:50 +0200
committerDaniel Wagner <daniel@wagner-home.com>2011-07-31 19:08:50 +0200
commit39f010d82d0292d9417a06abaf91dabb43ea3ef4 (patch)
tree1c701e3b4781a6460131c9e28e2705d8fb923f64 /XMonad/Prompt/Shell.hs
parent3eae9324c087da3fae57f2dcd9181eb850f12c1a (diff)
downloadXMonadContrib-39f010d82d0292d9417a06abaf91dabb43ea3ef4.tar.gz
XMonadContrib-39f010d82d0292d9417a06abaf91dabb43ea3ef4.tar.xz
XMonadContrib-39f010d82d0292d9417a06abaf91dabb43ea3ef4.zip
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
Diffstat (limited to 'XMonad/Prompt/Shell.hs')
-rw-r--r--XMonad/Prompt/Shell.hs9
1 files changed, 7 insertions, 2 deletions
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