diff options
author | Joey Hess <joey@kitenet.net> | 2012-02-03 16:48:40 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-02-03 16:48:40 -0400 |
commit | 44b115e0b11b3cb64301ed6dc478c597062ac0b6 (patch) | |
tree | 5ca8be141278790fcf1ca0c6a739fa68ccc59415 /Utility/Misc.hs | |
parent | d8fb97806c430be8358b2b77d67c02e876278d2f (diff) | |
parent | 146c36ca545a297f1e44e3cf2c91f3c0e17c909f (diff) |
Merge branch 'master' into ghc7.4
Conflicts:
Utility/Misc.hs
Diffstat (limited to 'Utility/Misc.hs')
-rw-r--r-- | Utility/Misc.hs | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/Utility/Misc.hs b/Utility/Misc.hs index c4992e142..9c284c826 100644 --- a/Utility/Misc.hs +++ b/Utility/Misc.hs @@ -8,9 +8,7 @@ module Utility.Misc where import System.IO -import System.IO.Error (try) import Control.Monad -import Control.Applicative import GHC.IO.Encoding {- Sets a Handle to use the filesystem encoding. This causes data @@ -45,22 +43,3 @@ separate c l = unbreak $ break c l {- Breaks out the first line. -} firstLine :: String-> String firstLine = takeWhile (/= '\n') - -{- Catches IO errors and returns a Bool -} -catchBoolIO :: IO Bool -> IO Bool -catchBoolIO a = catchDefaultIO a False - -{- Catches IO errors and returns a Maybe -} -catchMaybeIO :: IO a -> IO (Maybe a) -catchMaybeIO a = catchDefaultIO (Just <$> a) Nothing - -{- Catches IO errors and returns a default value. -} -catchDefaultIO :: IO a -> a -> IO a -catchDefaultIO a def = catch a (const $ return def) - -{- Catches IO errors and returns the error message. -} -catchMsgIO :: IO a -> IO (Either String a) -catchMsgIO a = dispatch <$> try a - where - dispatch (Left e) = Left $ show e - dispatch (Right v) = Right v |