summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-31 23:24:16 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-31 23:24:16 -0400
commit00d4c7cd01b6f6e863a22483b9ea20ca5260da43 (patch)
tree2c345eb26dfab3f8bc107764f20343fecb45014e
parentf3e4633e359d0a4afc7a0f90a89e4d276b597d84 (diff)
simplify evals
-rw-r--r--Annex.hs3
-rw-r--r--Remotes.hs3
-rw-r--r--git-annex.hs2
3 files changed, 5 insertions, 3 deletions
diff --git a/Annex.hs b/Annex.hs
index 63eef5158..8f60a0bf4 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -8,6 +8,7 @@
module Annex (
new,
run,
+ eval,
gitRepo,
gitRepoChange,
backends,
@@ -50,6 +51,8 @@ new gitrepo allbackends = do
{- performs an action in the Annex monad -}
run :: AnnexState -> StateT AnnexState IO a -> IO (a, AnnexState)
run state action = runStateT (action) state
+eval :: AnnexState -> StateT AnnexState IO a -> IO a
+eval state action = evalStateT (action) state
{- Returns the git repository being acted on -}
gitRepo :: Annex Git.Repo
diff --git a/Remotes.hs b/Remotes.hs
index a01da7d48..2879516fe 100644
--- a/Remotes.hs
+++ b/Remotes.hs
@@ -93,8 +93,7 @@ inAnnex r key = do
-- run a local check by making an Annex monad
-- using the remote
a <- Annex.new r []
- (result, _) <- Annex.run a (Core.inAnnex key)
- return result
+ Annex.eval a (Core.inAnnex key)
remote = do
-- remote check via ssh in and test
boolSystem "ssh" [Git.urlHost r, "test -e " ++
diff --git a/git-annex.hs b/git-annex.hs
index d798d417b..e958ac2f9 100644
--- a/git-annex.hs
+++ b/git-annex.hs
@@ -40,7 +40,7 @@ tryRun' state errnum (a:as) = do
result <- try $ Annex.run state a
case (result) of
Left err -> do
- _ <- Annex.run state $ showErr err
+ Annex.eval state $ showErr err
tryRun' state (errnum + 1) as
Right (True,state') -> tryRun' state' errnum as
Right (False,state') -> tryRun' state' (errnum + 1) as