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.
This commit is contained in:
parent
75a3f5027f
commit
c91929f693
16 changed files with 60 additions and 63 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue