diff options
author | jao <jao@gnu.org> | 2020-05-11 19:32:06 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2020-05-11 19:32:06 +0100 |
commit | ad64ccf601e76a4504aacffffa234233b30ee24d (patch) | |
tree | 60fd226210aa54628126d51d6e32a269d288e9eb | |
parent | 6faa17e39d7bf77df9aa199db09d52a600984271 (diff) | |
download | xmobar-ad64ccf601e76a4504aacffffa234233b30ee24d.tar.gz xmobar-ad64ccf601e76a4504aacffffa234233b30ee24d.tar.bz2 |
more hlinting
-rw-r--r-- | src/Xmobar/System/Utils.hs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/Xmobar/System/Utils.hs b/src/Xmobar/System/Utils.hs index d532149..53052ea 100644 --- a/src/Xmobar/System/Utils.hs +++ b/src/Xmobar/System/Utils.hs @@ -27,6 +27,7 @@ module Xmobar.System.Utils import Control.Monad import Control.Concurrent.STM import qualified Data.List.NonEmpty as NE +import Data.Maybe (fromMaybe) import System.Environment import System.FilePath @@ -67,6 +68,4 @@ 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 - Nothing -> NE.head xs - Just value -> value +safeIndex xs index = fromMaybe (NE.head xs) (NE.toList xs !!? index) |