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 /Remote/Rsync.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 'Remote/Rsync.hs')
-rw-r--r-- | Remote/Rsync.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index c15ab37a7..53418a9ef 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -10,7 +10,7 @@ module Remote.Rsync (remote) where import qualified Data.ByteString.Lazy.Char8 as L import Control.Exception.Extensible (IOException) import qualified Data.Map as M -import Control.Monad.State (liftIO, when) +import Control.Monad.State (liftIO) import System.FilePath import System.Directory import System.Posix.Files @@ -168,9 +168,8 @@ withRsyncScratchDir a = do nuke tmp return res where - nuke d = liftIO $ do - e <- doesDirectoryExist d - when e $ liftIO $ removeDirectoryRecursive d + nuke d = liftIO $ + doesDirectoryExist d <&> removeDirectoryRecursive d rsyncRemote :: RsyncOpts -> [CommandParam] -> Annex Bool rsyncRemote o params = do |