diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2012-10-06 22:39:56 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2012-10-06 22:39:56 +0200 |
commit | cbc0c9ac5219182ccd384eb5a4bbf3c4cad4f446 (patch) | |
tree | 2fdd81bf8607bbd75653571fd4a575467e175f8d | |
parent | a01c73f820813ad0c9459ecf1465cdc99093ee27 (diff) | |
download | xmobar-cbc0c9ac5219182ccd384eb5a4bbf3c4cad4f446.tar.gz xmobar-cbc0c9ac5219182ccd384eb5a4bbf3c4cad4f446.tar.bz2 |
Not using deprecated `catch` in Prelude
-rw-r--r-- | src/Plugins/Monitors/Bright.hs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Plugins/Monitors/Bright.hs b/src/Plugins/Monitors/Bright.hs index 107bd89..0679ab8 100644 --- a/src/Plugins/Monitors/Bright.hs +++ b/src/Plugins/Monitors/Bright.hs @@ -14,6 +14,7 @@ module Plugins.Monitors.Bright (brightConfig, runBright) where +import Control.Exception (SomeException, handle) import qualified Data.ByteString.Lazy.Char8 as B import Data.Char import System.FilePath ((</>)) @@ -88,7 +89,8 @@ readBright files = do currVal<- grab $ (fCurr files) maxVal <- grab $ (fMax files) return $ (currVal / maxVal) - where grab f = catch (fmap (read . B.unpack) $ B.readFile f)(\_ -> return 0) + where grab f = handle handler (fmap (read . B.unpack) $ B.readFile f) + handler = const (return 0) :: SomeException -> IO Float showHorizontalBar :: Float -> Monitor String showHorizontalBar x = do |