main :: IO ()
main = do d <- getCurrentDirectory
flip finally (setCurrentDirectory d) $ do
- setCurrentDirectory "copyFile"
- try $ removeFile to
+ setCurrentDirectory "copyFile002dir"
+ tryIO $ removeFile to
cs_before <- getDirectoryContents "."
putStrLn "Before:"
print $ sort cs_before
print $ sort cs_before
readFile to >>= print
+tryIO :: IO a -> IO (Either IOException a)
+tryIO = try
+
from, to :: FilePath
from = "source"
to = "target"