diff options
author | Joey Hess <joey@kitenet.net> | 2012-03-16 02:12:56 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-03-16 02:12:56 -0400 |
commit | b06336fa3a146e9a0ef1a1307b1fc219570795c6 (patch) | |
tree | b21bc1ee44364efbfac348704e2eeea00925994f /Utility/Exception.hs | |
parent | 184a69171d5d983ee2f08cce28011d235f44cc5c (diff) |
simplify
Diffstat (limited to 'Utility/Exception.hs')
-rw-r--r-- | Utility/Exception.hs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/Utility/Exception.hs b/Utility/Exception.hs index 7b6c9c999..a6726945c 100644 --- a/Utility/Exception.hs +++ b/Utility/Exception.hs @@ -25,10 +25,7 @@ catchDefaultIO a def = catchIO a (const $ return def) {- Catches IO errors and returns the error message. -} catchMsgIO :: IO a -> IO (Either String a) -catchMsgIO a = dispatch <$> tryIO a - where - dispatch (Left e) = Left $ show e - dispatch (Right v) = Right v +catchMsgIO a = either (Left . show) Right <$> tryIO a {- catch specialized for IO errors only -} catchIO :: IO a -> (IOException -> IO a) -> IO a |