--- src/IPatch/Common.hs.orig 2014-01-25 15:50:41.000000000 +0100 +++ src/IPatch/Common.hs 2014-01-25 16:17:01.000000000 +0100 @@ -16,11 +16,12 @@ - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -} -{-# LANGUAGE Rank2Types, ScopedTypeVariables, TypeFamilies, GADTs #-} +{-# LANGUAGE Rank2Types, ScopedTypeVariables, TypeFamilies, GADTs, ScopedTypeVariables #-} module IPatch.Common where import Control.Applicative ( (<$>) ) import Control.Monad ( when, unless ) +import Control.Exception ( catch, IOException ) import System.Posix.Files ( getSymbolicLinkStatus, isRegularFile, isDirectory ) import System.Directory ( createDirectoryIfMissing, doesFileExist, removeFile ) import System.FilePath.Posix ( (</>), takeDirectory, normalise ) @@ -75,7 +76,7 @@ else do exT <- doesFileExist dest' when exT $ removeFile dest' - `catch` fail ("clonePathWithDeletion: Bad file " ++ source </> path) + `catch` (\(_ :: IOException) -> fail ("clonePathWithDeletion: Bad file " ++ source </> path)) clonePathsWithDeletion source dest = mapM_ (clonePathWithDeletion source dest) @@ -144,8 +145,8 @@ exitWith $ ExitFailure 1 -- Now we obliterate the patch, undoing its effects - applyToWorking repo [] (invert patch_ps) `catch` \e -> - fail ("Couldn't undo diff effect in working dir.\n" ++ show e) + applyToWorking repo [] (invert patch_ps) `catch` (\(e :: IOException) -> + fail ("Couldn't undo diff effect in working dir.\n" ++ show e)) return (Sealed patch_ps) --- src/IPatch/Apply.hs.orig 2014-01-25 16:16:07.000000000 +0100 +++ src/IPatch/Apply.hs 2014-01-25 16:16:40.000000000 +0100 @@ -20,6 +20,7 @@ module IPatch.Apply where import Control.Monad ( when ) +import Control.Exception ( catch, IOException ) import System.Exit ( exitWith, ExitCode(ExitSuccess) ) import Data.Functor @@ -100,8 +101,8 @@ exitWith ExitSuccess debugMessage $ "Applying selected patches" - applyToWorking repo opts wanted_ps `catch` \e -> - fail ("Error applying patch to working dir:\n" ++ show e) + applyToWorking repo opts wanted_ps `catch` (\(e :: IOException) -> + fail ("Error applying patch to working dir:\n" ++ show e)) yorn <- promptYorn "Really apply the selected changes?" when yorn $ do