diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-11-08 21:48:19 +0100 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2011-11-08 21:48:19 +0100 |
commit | f512034c339ce24fbcac829024bd35b676347d60 (patch) | |
tree | 6592f22c82421dadd886dc67c526c1a0bbbfb9f3 /src/Plugins/Monitors | |
parent | b08c8830e1db1942dd0a1b00fea4e195e4c75a14 (diff) | |
download | xmobar-f512034c339ce24fbcac829024bd35b676347d60.tar.gz xmobar-f512034c339ce24fbcac829024bd35b676347d60.tar.bz2 |
Battery: last vestiges of lazy io removed
Diffstat (limited to 'src/Plugins/Monitors')
-rw-r--r-- | src/Plugins/Monitors/Batt.hs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/Plugins/Monitors/Batt.hs b/src/Plugins/Monitors/Batt.hs index ccb75eb..d1403e6 100644 --- a/src/Plugins/Monitors/Batt.hs +++ b/src/Plugins/Monitors/Batt.hs @@ -24,8 +24,6 @@ import System.IO (IOMode(ReadMode), hGetLine, withFile) import System.Posix.Files (fileExist) import System.Console.GetOpt -import qualified Data.ByteString.Lazy.Char8 as B - data BattOpts = BattOpts { onString :: String , offString :: String @@ -130,7 +128,7 @@ readBattery files = (3600 * b / 1000000) -- wattseconds (c / 1000000) -- volts (if c > 0 then (d / c) else -1) -- amperes - where grab f = handle onError (fmap (read . B.unpack) $ B.readFile f) + where grab f = handle onError $ withFile f ReadMode (fmap read . hGetLine) onError = const (return (-1)) :: SomeException -> IO Float readBatteries :: BattOpts -> [Files] -> IO Result |