summaryrefslogtreecommitdiff
path: root/Command/DropUnused.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-17 03:10:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-17 03:13:11 -0400
commitc91929f6934fc4e94603d0fa004e824d5e2cfb65 (patch)
treee958f5b4dc1209afb90c786493164c351dea4b9a /Command/DropUnused.hs
parent75a3f5027f74565d909fb940893636d081d9872a (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 'Command/DropUnused.hs')
-rw-r--r--Command/DropUnused.hs5
1 files changed, 2 insertions, 3 deletions
diff --git a/Command/DropUnused.hs b/Command/DropUnused.hs
index 965a99ed5..1bb3b7f97 100644
--- a/Command/DropUnused.hs
+++ b/Command/DropUnused.hs
@@ -7,7 +7,6 @@
module Command.DropUnused where
-import Control.Monad (when)
import Control.Monad.State (liftIO)
import qualified Data.Map as M
import System.Directory
@@ -24,6 +23,7 @@ import qualified Remote
import qualified GitRepo as Git
import Backend
import Key
+import Utility
type UnusedMap = M.Map String Key
@@ -72,8 +72,7 @@ performOther :: (Git.Repo -> Key -> FilePath) -> Key -> CommandPerform
performOther filespec key = do
g <- Annex.gitRepo
let f = filespec g key
- e <- liftIO $ doesFileExist f
- when e $ liftIO $ removeFile f
+ liftIO $ whenM (doesFileExist f) $ removeFile f
next $ return True
readUnusedLog :: FilePath -> Annex UnusedMap