diff options
author | Sibi Prabakaran <sibi@psibi.in> | 2020-06-14 15:23:30 +0530 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-06-23 16:38:20 +0100 |
commit | 505615b7fab38ba81fda92e0fba5b3d59cecc948 (patch) | |
tree | e7778cd4ae753e8763cbbc14f73ad39744949867 | |
parent | 66b7372d725bf5caade46c998e1597a8d1842ad2 (diff) | |
download | xmobar-505615b7fab38ba81fda92e0fba5b3d59cecc948.tar.gz xmobar-505615b7fab38ba81fda92e0fba5b3d59cecc948.tar.bz2 |
Fix warnings
-rw-r--r-- | src/Xmobar/Plugins/Monitors/Common/Parsers.hs | 17 |
1 files 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] |