diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-17 00:18:07 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-17 00:18:07 -0400 |
commit | e8188ea611e4c9223492203c0ec0370c3c45b225 (patch) | |
tree | 2a078993be28d1dedc38f8ab9ad193eea0ecf90e /Utility/Exception.hs | |
parent | ba744c84a4f683e50bf4c9b8c388e3a611f7fb91 (diff) |
flip catchDefaultIO
Diffstat (limited to 'Utility/Exception.hs')
-rw-r--r-- | Utility/Exception.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Utility/Exception.hs b/Utility/Exception.hs index a6726945c..8b6077743 100644 --- a/Utility/Exception.hs +++ b/Utility/Exception.hs @@ -13,15 +13,15 @@ import Control.Applicative {- Catches IO errors and returns a Bool -} catchBoolIO :: IO Bool -> IO Bool -catchBoolIO a = catchDefaultIO a False +catchBoolIO a = catchDefaultIO False a {- Catches IO errors and returns a Maybe -} catchMaybeIO :: IO a -> IO (Maybe a) -catchMaybeIO a = catchDefaultIO (Just <$> a) Nothing +catchMaybeIO a = catchDefaultIO Nothing $ Just <$> a {- Catches IO errors and returns a default value. -} -catchDefaultIO :: IO a -> a -> IO a -catchDefaultIO a def = catchIO a (const $ return def) +catchDefaultIO :: a -> IO a -> IO a +catchDefaultIO def a = catchIO a (const $ return def) {- Catches IO errors and returns the error message. -} catchMsgIO :: IO a -> IO (Either String a) |