From c91929f6934fc4e94603d0fa004e824d5e2cfb65 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 17 May 2011 03:10:13 -0400 Subject: 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. --- Command/RecvKey.hs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Command/RecvKey.hs') diff --git a/Command/RecvKey.hs b/Command/RecvKey.hs index 126608f61..b49116de4 100644 --- a/Command/RecvKey.hs +++ b/Command/RecvKey.hs @@ -7,13 +7,13 @@ module Command.RecvKey where -import Control.Monad (when) import Control.Monad.State (liftIO) import System.Exit import Command import CmdLine import Content +import Utility import RsyncFile command :: [Command] @@ -25,9 +25,7 @@ seek = [withKeys start] start :: CommandStartKey start key = do - present <- inAnnex key - when present $ - error "key is already present in annex" + whenM (inAnnex key) $ error "key is already present in annex" ok <- getViaTmp key (liftIO . rsyncServerReceive) if ok -- cgit v1.2.3