From 6ac13d70d701bc6f0e8a24ef4fa67e501403fe81 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 11 Dec 2010 14:18:49 -0500 Subject: Don't hard code the number of values Make an infinite list of empty strings so that if something is asked for and cannot be provided, index errors don't occur. --- Plugins/Monitors/MultiCpu.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Plugins/Monitors/MultiCpu.hs') diff --git a/Plugins/Monitors/MultiCpu.hs b/Plugins/Monitors/MultiCpu.hs index 17620d5..492ad96 100644 --- a/Plugins/Monitors/MultiCpu.hs +++ b/Plugins/Monitors/MultiCpu.hs @@ -50,7 +50,7 @@ percent b a = if tot > 0 then map (/ tot) $ take 4 dif else [0, 0, 0, 0] tot = foldr (+) 0 dif formatMultiCpus :: [[Float]] -> Monitor [String] -formatMultiCpus [] = showPercentsWithColors $ replicate 15 0.0 +formatMultiCpus [] = return $ repeat "" formatMultiCpus xs = fmap concat $ mapM formatCpu xs formatCpu :: [Float] -> Monitor [String] -- cgit v1.2.3