From 505615b7fab38ba81fda92e0fba5b3d59cecc948 Mon Sep 17 00:00:00 2001 From: Sibi Prabakaran Date: Sun, 14 Jun 2020 15:23:30 +0530 Subject: Fix warnings --- src/Xmobar/Plugins/Monitors/Common/Parsers.hs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Xmobar/Plugins/Monitors/Common/Parsers.hs b/src/Xmobar/Plugins/Monitors/Common/Parsers.hs index d814349..99b4aaf 100644 --- a/src/Xmobar/Plugins/Monitors/Common/Parsers.hs +++ b/src/Xmobar/Plugins/Monitors/Common/Parsers.hs @@ -48,19 +48,16 @@ runExportParser :: [String] -> IO [(String, [(String, String,String)])] runExportParser [] = pure [] runExportParser (x:xs) = do s <- runP templateParser x - rem <- runExportParser xs - pure $ (x,s):rem + rest <- runExportParser xs + pure $ (x,s):rest pureParseTemplate :: PureConfig -> TemplateInput -> IO String pureParseTemplate PureConfig{..} TemplateInput{..} = - do let t = pTemplate - e = pExport - w = pMaxTotalWidth - let m = let expSnds :: [([(String, String, String)], String)] = zip (map snd temAllTemplate) temMonitorValues - in Map.fromList . zip (map fst temAllTemplate) $ expSnds + do let m = let expSnds :: [([(String, String, String)], String)] = zip (map snd temAllTemplate) temMonitorValues + in Map.fromList $ zip (map fst temAllTemplate) $ expSnds s <- minCombine m temInputTemplate - let (n, s') = if w > 0 && length s > w - then trimTo (w - length pMaxTotalWidthEllipsis) "" s + let (n, s') = if pMaxTotalWidth > 0 && length s > pMaxTotalWidth + then trimTo (pMaxTotalWidth - length pMaxTotalWidthEllipsis) "" s else (1, s) return $ if n > 0 then s' else s' ++ pMaxTotalWidthEllipsis @@ -70,7 +67,7 @@ minCombine m ((s,ts,ss):xs) = do next <- minCombine m xs str <- case Map.lookup ts m of Nothing -> return $ "<" ++ ts ++ ">" - Just (s,r) -> let f "" = r; f n = n; in f <$> minCombine m s + Just (s',r) -> let f "" = r; f n = n; in f <$> minCombine m s' pure $ s ++ str ++ ss ++ next runP :: Parser [a] -> String -> IO [a] -- cgit v1.2.3