From cbc0c9ac5219182ccd384eb5a4bbf3c4cad4f446 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 6 Oct 2012 22:39:56 +0200 Subject: Not using deprecated `catch` in Prelude --- src/Plugins/Monitors/Bright.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3