summaryrefslogtreecommitdiffhomepage
path: root/src/Plugins/Monitors/Common.hs
diff options
context:
space:
mode:
authorTony Morris <tmorris@tmorris.net>2014-08-29 08:44:17 +1000
committerTony Morris <tmorris@tmorris.net>2014-08-29 08:44:17 +1000
commit4fc5b8a1b5998dff4717478b6772878c1ed2de7f (patch)
tree2b81c255e5f9e109a1e5bc937681659382c1d095 /src/Plugins/Monitors/Common.hs
parentbbaf4e5800e6f5dea7ff3e09f260a94b5d432091 (diff)
downloadxmobar-4fc5b8a1b5998dff4717478b6772878c1ed2de7f.tar.gz
xmobar-4fc5b8a1b5998dff4717478b6772878c1ed2de7f.tar.bz2
hlint improvements
Diffstat (limited to 'src/Plugins/Monitors/Common.hs')
-rw-r--r--src/Plugins/Monitors/Common.hs20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Plugins/Monitors/Common.hs b/src/Plugins/Monitors/Common.hs
index 1fd09a6..971de16 100644
--- a/src/Plugins/Monitors/Common.hs
+++ b/src/Plugins/Monitors/Common.hs
@@ -463,15 +463,17 @@ showVerticalBar v x = colorizeString v [convert $ 100 * x]
where t = 9600 + (round val `div` 12)
showLogBar :: Float -> Float -> Monitor String
-showLogBar f v = do
- h <- fromIntegral `fmap` getConfigValue high
- l <- fromIntegral `fmap` getConfigValue low
- bw <- fromIntegral `fmap` getConfigValue barWidth
- let [ll, hh] = sort [l, h]
- choose x | x == 0.0 = 0
- | x <= ll = 1 / bw
- | otherwise = f + logBase 2 (x / hh) / bw
- showPercentBar v $ choose v
+showLogBar f v =
+ let intConfig c = fromIntegral `fmap` getConfigValue c
+ in do
+ h <- intConfig high
+ l <- intConfig low
+ bw <- intConfig barWidth
+ let [ll, hh] = sort [l, h]
+ choose x | x == 0.0 = 0
+ | x <= ll = 1 / bw
+ | otherwise = f + logBase 2 (x / hh) / bw
+ showPercentBar v $ choose v
showLogVBar :: Float -> Float -> Monitor String
showLogVBar f v = do