diff options
author | Jose A. Ortega Ruiz <jao@gnu.org> | 2010-01-18 02:06:39 +0100 |
---|---|---|
committer | Jose A. Ortega Ruiz <jao@gnu.org> | 2010-01-18 02:06:39 +0100 |
commit | d7c62ed01b25fb001dec0f9b472273be55b00363 (patch) | |
tree | d766aa945a8ec497c2971f4283f71bcc26bd19b6 | |
parent | 5b5820a20b6e43b4b2e3747b1b1a5b52a168aa63 (diff) | |
download | xmobar-d7c62ed01b25fb001dec0f9b472273be55b00363.tar.gz xmobar-d7c62ed01b25fb001dec0f9b472273be55b00363.tar.bz2 |
Small refactoring
Ignore-this: 886cfda3510443d12f90c6184bf7f6e6
darcs-hash:20100118010639-40885-c69f6371d0ac730d14859f78f4b091e9327e551d.gz
-rw-r--r-- | Plugins/Monitors/MultiCpu.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Plugins/Monitors/MultiCpu.hs b/Plugins/Monitors/MultiCpu.hs index a77ba71..c0fa21a 100644 --- a/Plugins/Monitors/MultiCpu.hs +++ b/Plugins/Monitors/MultiCpu.hs @@ -30,11 +30,11 @@ cpuData = do s <- B.readFile "/proc/stat" return $ cpuParser s cpuParser :: B.ByteString -> [[Float]] -cpuParser = map (map read . tail) . lns - where lns = takeWhile isCpu . map unpW . B.lines - isCpu (w:_) = "cpu" `isPrefixOf` w +cpuParser = map parseList . cpuLists + where cpuLists = takeWhile isCpu . map B.words . B.lines + isCpu (w:_) = "cpu" `isPrefixOf` (B.unpack w) isCpu _ = False - unpW = map B.unpack . B.words + parseList = map (read . B.unpack) . tail parseCpuData :: IO [[Float]] parseCpuData = |