diff options
author | jao <jao@gnu.org> | 2020-05-11 19:22:41 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-05-11 19:22:41 +0100 |
commit | 6faa17e39d7bf77df9aa199db09d52a600984271 (patch) | |
tree | c41a1a3139a264b61a83d9979259b0cb021ed1b7 /src/Xmobar | |
parent | 3e9e1cb9d300e13109206496d825351c4f41cc1c (diff) | |
download | xmobar-6faa17e39d7bf77df9aa199db09d52a600984271.tar.gz xmobar-6faa17e39d7bf77df9aa199db09d52a600984271.tar.bz2 |
hlinting
Diffstat (limited to 'src/Xmobar')
-rw-r--r-- | src/Xmobar/System/Utils.hs | 2 | ||||
-rw-r--r-- | src/Xmobar/X11/Parsers.hs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/Xmobar/System/Utils.hs b/src/Xmobar/System/Utils.hs index 33f221c..d532149 100644 --- a/src/Xmobar/System/Utils.hs +++ b/src/Xmobar/System/Utils.hs @@ -67,6 +67,6 @@ onSomeException io what = io `catch` \e -> do _ <- what e {-# INLINE (!!?) #-} safeIndex :: NE.NonEmpty a -> Int -> a -safeIndex xs index = case (NE.toList xs) !!? index of +safeIndex xs index = case NE.toList xs !!? index of Nothing -> NE.head xs Just value -> value diff --git a/src/Xmobar/X11/Parsers.hs b/src/Xmobar/X11/Parsers.hs index 4c8a130..1d486d9 100644 --- a/src/Xmobar/X11/Parsers.hs +++ b/src/Xmobar/X11/Parsers.hs @@ -20,6 +20,7 @@ import Xmobar.Config.Types import Xmobar.X11.Actions import Control.Monad (guard, mzero) +import Data.Maybe (fromMaybe) import Text.ParserCombinators.Parsec import Text.Read (readMaybe) import Graphics.X11.Types (Button) @@ -139,7 +140,7 @@ fontParser :: ColorString -> Maybe [Action] -> Parser [(Widget, ColorString, FontIndex, Maybe [Action])] fontParser c a = do f <- between (string "<fn=") (string ">") colors - s <- manyTill (allParsers c (maybe 0 id $ readMaybe f) a) (try $ string "</fn>") + s <- manyTill (allParsers c (fromMaybe 0 $ readMaybe f) a) (try $ string "</fn>") return (concat s) -- | Parses a color specification (hex or named) |