diff options
author | Joey Hess <joey@kitenet.net> | 2011-05-17 03:10:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-05-17 03:13:11 -0400 |
commit | c91929f6934fc4e94603d0fa004e824d5e2cfb65 (patch) | |
tree | e958f5b4dc1209afb90c786493164c351dea4b9a /CopyFile.hs | |
parent | 75a3f5027f74565d909fb940893636d081d9872a (diff) |
add whenM and unlessM
Just more golfing.. I am pretty sure something in a library somewhere can
do this, but I have been unable to find it.
Diffstat (limited to 'CopyFile.hs')
-rw-r--r-- | CopyFile.hs | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/CopyFile.hs b/CopyFile.hs index 4575fb08a..b08ede3c8 100644 --- a/CopyFile.hs +++ b/CopyFile.hs @@ -7,7 +7,6 @@ module CopyFile (copyFile) where -import Control.Monad (when) import System.Directory (doesFileExist, removeFile) import Utility @@ -17,8 +16,7 @@ import qualified SysConfig - and because this allows easy access to features like cp --reflink. -} copyFile :: FilePath -> FilePath -> IO Bool copyFile src dest = do - e <- doesFileExist dest - when e $ + whenM (doesFileExist dest) $ removeFile dest boolSystem "cp" [params, File src, File dest] where |