simplify evals
This commit is contained in:
		
					parent
					
						
							
								f3e4633e35
							
						
					
				
			
			
				commit
				
					
						00d4c7cd01
					
				
			
		
					 3 changed files with 5 additions and 3 deletions
				
			
		
							
								
								
									
										3
									
								
								Annex.hs
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								Annex.hs
									
										
									
									
									
								
							|  | @ -8,6 +8,7 @@ | ||||||
| module Annex ( | module Annex ( | ||||||
| 	new, | 	new, | ||||||
| 	run, | 	run, | ||||||
|  | 	eval, | ||||||
| 	gitRepo, | 	gitRepo, | ||||||
| 	gitRepoChange, | 	gitRepoChange, | ||||||
| 	backends, | 	backends, | ||||||
|  | @ -50,6 +51,8 @@ new gitrepo allbackends = do | ||||||
| {- performs an action in the Annex monad -} | {- performs an action in the Annex monad -} | ||||||
| run :: AnnexState -> StateT AnnexState IO a -> IO (a, AnnexState) | run :: AnnexState -> StateT AnnexState IO a -> IO (a, AnnexState) | ||||||
| run state action = runStateT (action) state | 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 -} | {- Returns the git repository being acted on -} | ||||||
| gitRepo :: Annex Git.Repo | gitRepo :: Annex Git.Repo | ||||||
|  |  | ||||||
|  | @ -93,8 +93,7 @@ inAnnex r key = do | ||||||
| 			-- run a local check by making an Annex monad | 			-- run a local check by making an Annex monad | ||||||
| 			-- using the remote | 			-- using the remote | ||||||
| 			a <- Annex.new r [] | 			a <- Annex.new r [] | ||||||
| 			(result, _) <- Annex.run a (Core.inAnnex key) | 			Annex.eval a (Core.inAnnex key) | ||||||
| 			return result |  | ||||||
| 		remote = do | 		remote = do | ||||||
| 			-- remote check via ssh in and test | 			-- remote check via ssh in and test | ||||||
| 			boolSystem "ssh" [Git.urlHost r, "test -e " ++ | 			boolSystem "ssh" [Git.urlHost r, "test -e " ++ | ||||||
|  |  | ||||||
|  | @ -40,7 +40,7 @@ tryRun' state errnum (a:as) = do | ||||||
| 	result <- try $ Annex.run state a | 	result <- try $ Annex.run state a | ||||||
| 	case (result) of | 	case (result) of | ||||||
| 		Left err -> do | 		Left err -> do | ||||||
| 			_ <- Annex.run state $ showErr err | 			Annex.eval state $ showErr err | ||||||
| 			tryRun' state (errnum + 1) as | 			tryRun' state (errnum + 1) as | ||||||
| 		Right (True,state') -> tryRun' state' errnum as | 		Right (True,state') -> tryRun' state' errnum as | ||||||
| 		Right (False,state') -> tryRun' state' (errnum + 1) as | 		Right (False,state') -> tryRun' state' (errnum + 1) as | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Joey Hess
				Joey Hess