summaryrefslogtreecommitdiffhomepage
path: root/src/app
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2018-11-22 01:10:39 +0000
committerjao <jao@gnu.org>2018-11-22 01:45:47 +0000
commitc84a2e586563cce90f4324eb38bfb2e2207eb7fc (patch)
treef073eb5f6254e051cd55b7ae30f0b1763152178e /src/app
parent50134d5b5c4baabdfb35c0aeb8bf53d29f009c4d (diff)
downloadxmobar-c84a2e586563cce90f4324eb38bfb2e2207eb7fc.tar.gz
xmobar-c84a2e586563cce90f4324eb38bfb2e2207eb7fc.tar.bz2
Wee refactorings
Diffstat (limited to 'src/app')
-rw-r--r--src/app/Main.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/app/Main.hs b/src/app/Main.hs
index c96c47e..22834b1 100644
--- a/src/app/Main.hs
+++ b/src/app/Main.hs
@@ -40,6 +40,7 @@ import System.Posix.Files
import Control.Concurrent.Async (Async, cancel)
import Control.Exception (bracket)
import Control.Monad (unless)
+import Control.Monad.IO.Class (liftIO)
import Text.Read (readMaybe)
import Xmobar.Signal (setupSignalHandler, withDeferSignals)
@@ -100,9 +101,9 @@ splitTemplate conf =
-- | Reads the configuration files or quits with an error
readConfig :: FilePath -> IO (Config,[String])
readConfig f = do
- file <- io $ fileExist f
- s <- io $ if file then readFileSafe f else error $
- f ++ ": file not found!\n" ++ usage
+ file <- liftIO $ fileExist f
+ s <- liftIO $ if file then readFileSafe f else error $
+ f ++ ": file not found!\n" ++ usage
either (\err -> error $ f ++
": configuration file contains errors at:\n" ++ show err)
return $ parseConfig s
@@ -123,10 +124,10 @@ getXdgConfigFile = fmap (</> "xmobarrc") xmobarConfigDir
readDefaultConfig :: IO (Config,[String])
readDefaultConfig = do
xdgConfigFile <- getXdgConfigFile
- xdgConfigFileExists <- io $ fileExist xdgConfigFile
- home <- io $ getEnv "HOME"
+ xdgConfigFileExists <- liftIO $ fileExist xdgConfigFile
+ home <- liftIO $ getEnv "HOME"
let defaultConfigFile = home ++ "/.xmobarrc"
- defaultConfigFileExists <- io $ fileExist defaultConfigFile
+ defaultConfigFileExists <- liftIO $ fileExist defaultConfigFile
if xdgConfigFileExists
then readConfig xdgConfigFile
else if defaultConfigFileExists