summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-08 12:01:20 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-07-08 12:01:20 +0200
commit6d2519cb84ebd56a7b270bc58b4e352b291624f6 (patch)
tree3854257e5998ffc37398328bd301aae8af78a927
parentc733fb4a4069fa8b41901a9763cbd1769c548517 (diff)
downloadxmobar-6d2519cb84ebd56a7b270bc58b4e352b291624f6.tar.gz
xmobar-6d2519cb84ebd56a7b270bc58b4e352b291624f6.tar.bz2
added runM to run monitors internally
darcs-hash:20070708100120-d6583-1db3f135af0e31652c0f62f974f8f52f9845ea18.gz
-rw-r--r--Monitors/Common.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Monitors/Common.hs b/Monitors/Common.hs
index c53d1f6..e4c1562 100644
--- a/Monitors/Common.hs
+++ b/Monitors/Common.hs
@@ -21,6 +21,7 @@ module Monitors.Common (
, setConfigValue
, getConfigValue
, runMonitor
+ , runM
, io
-- * Parsers
-- $parsers
@@ -172,6 +173,12 @@ runMonitor conf actionFail action =
let ac = doArgs args actionFail action
putStrLn =<< runReaderT ac c
+runM :: [String] -> IO MConfig -> Monitor String -> ([String] -> Monitor String) -> IO String
+runM args conf actionFail action =
+ do c <- conf
+ let ac = doArgs args actionFail action
+ runReaderT ac c
+
io :: IO a -> Monitor a
io = liftIO