summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-17 11:44:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-17 11:45:24 -0400
commit21d9c84e7292a8984ea5d46c0134ddc6ff19babc (patch)
tree4ad29fe99c515c5d8fd27233c88611a8f792ec2d
parentc91929f6934fc4e94603d0fa004e824d5e2cfb65 (diff)
more standard names for whenM and unlessM operators
These are defined in ifelse, but it's not currently available and I don't want to pull in a library for 6 lines of code anyhow. Also, ifelse sets the fixity to 1, which does not allow >>? error $ ...
-rw-r--r--GitRepo.hs2
-rw-r--r--Remote/Bup.hs4
-rw-r--r--Remote/Directory.hs2
-rw-r--r--Remote/Rsync.hs2
-rw-r--r--Utility.hs16
5 files changed, 13 insertions, 13 deletions
diff --git a/GitRepo.hs b/GitRepo.hs
index d070bc89e..f489dfe35 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -331,7 +331,7 @@ gitCommandLine repo _ = assertLocal repo $ error "internal"
run :: Repo -> String -> [CommandParam] -> IO ()
run repo subcommand params = assertLocal repo $
boolSystem "git" (gitCommandLine repo ((Param subcommand):params))
- <|> error $ "git " ++ show params ++ " failed"
+ >>! error $ "git " ++ show params ++ " failed"
{- Runs a git subcommand and returns it output, lazily.
-
diff --git a/Remote/Bup.hs b/Remote/Bup.hs
index 51a5d05d1..c40826e5e 100644
--- a/Remote/Bup.hs
+++ b/Remote/Bup.hs
@@ -75,7 +75,7 @@ bupSetup u c = do
-- bup init will create the repository.
-- (If the repository already exists, bup init again appears safe.)
showNote "bup init"
- bup "init" buprepo [] <|> error "bup init failed"
+ bup "init" buprepo [] >>! error "bup init failed"
storeBupUUID u buprepo
@@ -173,7 +173,7 @@ storeBupUUID u buprepo = do
showNote "storing uuid"
onBupRemote r boolSystem "git"
[Params $ "config annex.uuid " ++ u]
- <|> error "ssh failed"
+ >>! error "ssh failed"
else liftIO $ do
r' <- Git.configRead r
let olduuid = Git.configGet r' "annex.uuid" ""
diff --git a/Remote/Directory.hs b/Remote/Directory.hs
index f69aa1256..dedab473f 100644
--- a/Remote/Directory.hs
+++ b/Remote/Directory.hs
@@ -63,7 +63,7 @@ directorySetup u c = do
let dir = maybe (error "Specify directory=") id $
M.lookup "directory" c
liftIO $ doesDirectoryExist dir
- <|> error $ "Directory does not exist: " ++ dir
+ >>! error $ "Directory does not exist: " ++ dir
c' <- encryptionSetup c
-- The directory is stored in git config, not in this remote's
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 53418a9ef..9d32ad19b 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -169,7 +169,7 @@ withRsyncScratchDir a = do
return res
where
nuke d = liftIO $
- doesDirectoryExist d <&> removeDirectoryRecursive d
+ doesDirectoryExist d >>? removeDirectoryRecursive d
rsyncRemote :: RsyncOpts -> [CommandParam] -> Annex Bool
rsyncRemote o params = do
diff --git a/Utility.hs b/Utility.hs
index 5aa0afea7..816464373 100644
--- a/Utility.hs
+++ b/Utility.hs
@@ -27,9 +27,9 @@ module Utility (
myHomeDir,
catchBool,
whenM,
- (<&>),
+ (>>?),
unlessM,
- (<|>),
+ (>>!),
prop_idempotent_shellEscape,
prop_idempotent_shellEscape_multiword,
@@ -271,12 +271,12 @@ whenM c a = c >>= flip when a
unlessM :: Monad m => m Bool -> m () -> m ()
unlessM c a = c >>= flip unless a
-(<&>) :: Monad m => m Bool -> m () -> m ()
-(<&>) = whenM
+(>>?) :: Monad m => m Bool -> m () -> m ()
+(>>?) = whenM
-(<|>) :: Monad m => m Bool -> m () -> m ()
-(<|>) = unlessM
+(>>!) :: Monad m => m Bool -> m () -> m ()
+(>>!) = unlessM
-- low fixity allows eg, foo bar <|> error $ "failed " ++ meep
-infixr 0 <&>
-infixr 0 <|>
+infixr 0 >>?
+infixr 0 >>!