summaryrefslogtreecommitdiffhomepage
path: root/Plugins/Monitors/MultiCpu.hs
diff options
context:
space:
mode:
authorJose A. Ortega Ruiz <jao@gnu.org>2010-01-19 23:23:47 +0100
committerJose A. Ortega Ruiz <jao@gnu.org>2010-01-19 23:23:47 +0100
commit2d6911f940ec82c2054cf96b151ac9ff61372865 (patch)
tree3517766676329b3acb170ad8b6a66f899df95560 /Plugins/Monitors/MultiCpu.hs
parente87272bf601bd2efa2c6ef08d6a42765b809e6d9 (diff)
downloadxmobar-2d6911f940ec82c2054cf96b151ac9ff61372865.tar.gz
xmobar-2d6911f940ec82c2054cf96b151ac9ff61372865.tar.bz2
MultiCpus: hlinting
Ignore-this: 3052c410453447cc9ff89950df4c0077 darcs-hash:20100119222347-40885-94bf85e137995f47d59af199c08b8c243aa297a6.gz
Diffstat (limited to 'Plugins/Monitors/MultiCpu.hs')
-rw-r--r--Plugins/Monitors/MultiCpu.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/Plugins/Monitors/MultiCpu.hs b/Plugins/Monitors/MultiCpu.hs
index 43283a8..1c89a76 100644
--- a/Plugins/Monitors/MultiCpu.hs
+++ b/Plugins/Monitors/MultiCpu.hs
@@ -21,7 +21,7 @@ import Data.List(isPrefixOf)
multiCpuConfig :: IO MConfig
multiCpuConfig = mkMConfig
"Cpu: <total>"
- [ k ++ n | n <- "":(map show [0 :: Int ..])
+ [ k ++ n | n <- "" : map show [0 :: Int ..]
, k <- ["total","user","nice","system","idle"]]
@@ -32,7 +32,7 @@ cpuData = do s <- B.readFile "/proc/stat"
cpuParser :: B.ByteString -> [[Float]]
cpuParser = map parseList . cpuLists
where cpuLists = takeWhile isCpu . map B.words . B.lines
- isCpu (w:_) = "cpu" `isPrefixOf` (B.unpack w)
+ isCpu (w:_) = "cpu" `isPrefixOf` B.unpack w
isCpu _ = False
parseList = map (read . B.unpack) . tail
@@ -57,13 +57,13 @@ formatMultiCpus xs = fmap concat $ mapM formatCpu xs
formatCpu :: [Float] -> Monitor [String]
formatCpu x
| length x < 4 = return $ take 5 emptyPercs
- | otherwise = mapM (showWithColors f) . map (* 100) $ (t:x)
- where f s = pad $ floatToPercent (s / 100)
+ | otherwise = mapM (showWithColors f . (* 100)) (t:x)
+ where f = pad . floatToPercent . (/ 100)
t = foldr (+) 0 $ take 3 x
pad s = take (4 - length s) " " ++ s
runMultiCpu :: [String] -> Monitor String
runMultiCpu _ =
- do c <- io $ parseCpuData
+ do c <- io parseCpuData
l <- formatMultiCpus c
parseTemplate l