summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors/Common.hs
diff options
context:
space:
mode:
authorTodd Lunter <tlunter@gmail.com>2013-05-26 13:34:41 -0400
committerTodd Lunter <tlunter@gmail.com>2013-05-26 13:34:41 -0400
commit0175e32e2a9226b274250b89bc02d7e8f251e552 (patch)
tree00d12c5c90275613609b9ada625fc03f63c3b2dc /src/Plugins/Monitors/Common.hs
parentf655873269ccd8992c5f5610327a24f78c449403 (diff)
downloadxmobar-0175e32e2a9226b274250b89bc02d7e8f251e552.tar.gz
xmobar-0175e32e2a9226b274250b89bc02d7e8f251e552.tar.bz2
Fixed the documentation around the functions to reflect the changes
Diffstat (limited to 'src/Plugins/Monitors/Common.hs')
-rw-r--r--src/Plugins/Monitors/Common.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs
index 5caaa85..973c5f9 100644
--- a/src/Plugins/Monitors/Common.hs
+++ b/src/Plugins/Monitors/Common.hs
@@ -306,14 +306,15 @@ parseTemplate l =
let m = Map.fromList . zip e $ l
parseTemplate' t m
--- | Works like parseTemplate, but using the given template string.
+-- | Parses the template given to it with a map of export values and combines
+-- them
parseTemplate' :: String -> Map.Map String String -> Monitor String
parseTemplate' t m =
do s <- io $ runP templateParser t
combine m s
--- | Given a finite "Map" and a parsed templatet produces the
--- | resulting output string.
+-- | Given a finite "Map" and a parsed template t produces the
+-- | resulting output string as the output of the monitor.
combine :: Map.Map String String -> [(String, String, String)] -> Monitor String
combine _ [] = return []
combine m ((s,ts,ss):xs) =
@@ -321,7 +322,7 @@ combine m ((s,ts,ss):xs) =
let str = Map.findWithDefault err ts m
err = "<" ++ ts ++ " not found!>"
nstr <- parseTemplate' str m
- return $ s ++ (if nstr == [] then str else nstr) ++ ss ++ next
+ return $ s ++ (if null nstr then str else nstr) ++ ss ++ next
-- $strings