summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-10-02 20:45:00 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-10-02 20:45:00 +0200
commit43e01ea9eee814d3984ebec9507cf5439caef149 (patch)
tree2b1741abdef2432d99e0fd7647ecb9552b2d7a34
parent230d3c8f18daecaf1b8344c7bfb98fb965a8c710 (diff)
downloadxmobar-43e01ea9eee814d3984ebec9507cf5439caef149.tar.gz
xmobar-43e01ea9eee814d3984ebec9507cf5439caef149.tar.bz2
more code formatting
darcs-hash:20071002184500-d6583-b41a042f203ec30a69264ca04afa98a8f8fe0026.gz
-rw-r--r--Main.hs51
1 files changed, 25 insertions, 26 deletions
diff --git a/Main.hs b/Main.hs
index 3ac4c6c..3bd20ff 100644
--- a/Main.hs
+++ b/Main.hs
@@ -33,38 +33,37 @@ import System.Posix.Files
-- | The main entry point
main :: IO ()
-main =
- do args <- getArgs
- (o,file) <- getOpts args
- c <- case file of
- [cfgfile] -> readConfig cfgfile
- _ -> readDefaultConfig
- civ <- newIORef c
- doOpts civ o
- conf <- readIORef civ
- cl <- parseTemplate conf (template conf)
- vars <- mapM startCommand cl
- (d,w) <- createWin conf
- eventLoop conf vars d w
- return ()
+main = do
+ args <- getArgs
+ (o,file) <- getOpts args
+ c <- case file of
+ [cfgfile] -> readConfig cfgfile
+ _ -> readDefaultConfig
+ civ <- newIORef c
+ doOpts civ o
+ conf <- readIORef civ
+ cl <- parseTemplate conf (template conf)
+ vars <- mapM startCommand cl
+ (d,w) <- createWin conf
+ eventLoop conf vars d w
-- | Reads the configuration files or quits with an error
readConfig :: FilePath -> IO Config
-readConfig f =
- do file <- fileExist f
- s <- if file then readFile f else error $ f ++ ": file not found!\n" ++ usage
- case reads s of
- [(conf,_)] -> return conf
- [] -> error $ f ++ ": configuration file contains errors!\n" ++ usage
- _ -> error ("Some problem occured. Aborting...")
+readConfig f = do
+ file <- fileExist f
+ s <- if file then readFile f else error $ f ++ ": file not found!\n" ++ usage
+ case reads s of
+ [(conf,_)] -> return conf
+ [] -> error $ f ++ ": configuration file contains errors!\n" ++ usage
+ _ -> error ("Some problem occured. Aborting...")
-- | Read default configuration file or load the default config
readDefaultConfig :: IO Config
-readDefaultConfig =
- do home <- getEnv "HOME"
- let path = home ++ "/.xmobarrc"
- f <- fileExist path
- if f then readConfig path else return defaultConfig
+readDefaultConfig = do
+ home <- getEnv "HOME"
+ let path = home ++ "/.xmobarrc"
+ f <- fileExist path
+ if f then readConfig path else return defaultConfig
data Opts = Help
| Version