summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors
diff options
context:
space:
mode:
authorMartin Perner <martin@perner.cc>2011-11-03 15:36:17 +0100
committerMartin Perner <martin@perner.cc>2011-11-03 15:40:20 +0100
commit67eee0be14c2966e9dcf6f4127e75da16b9942b7 (patch)
tree67fc1052954fb9b7054f7d71fb60a37db54df9ad /src/Plugins/Monitors
parent218d07606a7564cdcde5974d53b8e81d04c02a44 (diff)
downloadxmobar-67eee0be14c2966e9dcf6f4127e75da16b9942b7.tar.gz
xmobar-67eee0be14c2966e9dcf6f4127e75da16b9942b7.tar.bz2
fix for ghc6
added applicative instance for ReaderT which was added in GHC7
Diffstat (limited to 'src/Plugins/Monitors')
-rw-r--r--src/Plugins/Monitors/CoreCommon.hs13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Plugins/Monitors/CoreCommon.hs b/src/Plugins/Monitors/CoreCommon.hs
index e508f7d..eb3e17f 100644
--- a/src/Plugins/Monitors/CoreCommon.hs
+++ b/src/Plugins/Monitors/CoreCommon.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE PatternGuards #-}
+{-# LANGUAGE PatternGuards, CPP #-}
-----------------------------------------------------------------------------
-- |
@@ -25,6 +25,15 @@ import Data.Maybe
import Plugins.Monitors.Common
import System.Directory
+#ifdef GHC6
+import Control.Monad.Reader
+
+instance (Monad f, Applicative f) => Applicative (ReaderT r f) where
+ pure a = ReaderT $ const (pure a)
+ f <*> a = ReaderT $ \r ->
+ ((runReaderT f r) <*> (runReaderT a r))
+#endif
+
checkedDataRetrieval :: (Ord a, Num a)
=> String -> [String] -> Maybe (String, String -> Int)
-> (Double -> a) -> (a -> String) -> Monitor String
@@ -131,4 +140,4 @@ readFiles (fval, flbl) = (,) <$> either return (\(f, ex) -> liftM ex
-- | Function that captures if-then-else
ifthen :: a -> a -> Bool -> a
-ifthen thn els cnd = if cnd then thn else els \ No newline at end of file
+ifthen thn els cnd = if cnd then thn else els