[commit: packages/directory] improve-tests, improve-tests-for-real, master, tmp: Replace `throw` by `throwIO` (a5d0c5b)
git at git.haskell.org
git at git.haskell.org
Thu Mar 19 11:36:51 UTC 2015
Repository : ssh://git@git.haskell.org/directory
On branches: improve-tests,improve-tests-for-real,master,tmp
Link : http://ghc.haskell.org/trac/ghc/changeset/a5d0c5ba9d6f6603278a7b8e86edd7a29c51641d/directory
>---------------------------------------------------------------
commit a5d0c5ba9d6f6603278a7b8e86edd7a29c51641d
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Mon Jan 19 13:49:34 2015 +0100
Replace `throw` by `throwIO`
With `throwIO` it's better defined when the exception is actually
triggered.
>---------------------------------------------------------------
a5d0c5ba9d6f6603278a7b8e86edd7a29c51641d
System/Directory.hs | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/System/Directory.hs b/System/Directory.hs
index 1bf4172..98e4c20 100644
--- a/System/Directory.hs
+++ b/System/Directory.hs
@@ -366,11 +366,11 @@ createDirectoryIfMissing create_parents path0
parents = reverse . scanl1 (</>) . splitDirectories . normalise
createDirs [] = return ()
- createDirs (dir:[]) = createDir dir throw
+ createDirs (dir:[]) = createDir dir throwIO
createDirs (dir:dirs) =
createDir dir $ \_ -> do
createDirs dirs
- createDir dir throw
+ createDir dir throwIO
createDir :: FilePath -> (IOException -> IO ()) -> IO ()
createDir dir notExistHandler = do
@@ -398,15 +398,15 @@ createDirectoryIfMissing create_parents path0
withFileStatus "createDirectoryIfMissing" dir $ \st -> do
isDir <- isDirectory st
if isDir then return ()
- else throw e
+ else throwIO e
#else
stat <- Posix.getFileStatus dir
if Posix.isDirectory stat
then return ()
- else throw e
+ else throwIO e
#endif
) `E.catch` ((\_ -> return ()) :: IOException -> IO ())
- | otherwise -> throw e
+ | otherwise -> throwIO e
#if __GLASGOW_HASKELL__
{- | @'removeDirectory' dir@ removes an existing directory /dir/. The
@@ -475,7 +475,7 @@ removeDirectoryRecursive startLoc = do
case temp of
Left e -> do isDir <- doesDirectoryExist f
-- If f is not a directory, re-throw the error
- unless isDir $ throw (e :: SomeException)
+ unless isDir $ throwIO (e :: SomeException)
removeDirectoryRecursive f
Right _ -> return ()
@@ -669,7 +669,7 @@ copied to /new/, if possible.
copyFile :: FilePath -> FilePath -> IO ()
copyFile fromFPath toFPath =
- copy `catchIOError` (\exc -> throw $ ioeSetLocation exc "copyFile")
+ copy `catchIOError` (\exc -> throwIO $ ioeSetLocation exc "copyFile")
where copy = bracket (openBinaryFile fromFPath ReadMode) hClose $ \hFrom ->
bracketOnError openTmp cleanTmp $ \(tmpFPath, hTmp) ->
do allocaBytes bufferSize $ copyContents hFrom hTmp
@@ -1209,7 +1209,7 @@ getTemporaryDirectory = do
#else
getEnv "TMPDIR"
`catchIOError` \e -> if isDoesNotExistError e then return "/tmp"
- else throw e
+ else throwIO e
#endif
-- ToDo: This should be determined via autoconf (AC_EXEEXT)
More information about the ghc-commits
mailing list