From a362c46b70c45872ff8c479ba5a6716cf13cc8d8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 17 Mar 2012 00:22:05 -0400 Subject: fun with symbols Nothing at all on hackage is using <&&> or <||>. (Also, <&&> should short-circuit on failure.) --- Remote/Git.hs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'Remote') diff --git a/Remote/Git.hs b/Remote/Git.hs index 5c10c0fc9..3725edd3a 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -7,8 +7,8 @@ module Remote.Git (remote, repoAvail) where -import Control.Exception.Extensible import qualified Data.Map as M +import Control.Exception.Extensible import Common.Annex import Utility.CopyFile @@ -102,11 +102,8 @@ tryGitConfigRead r where -- Reading config can fail due to IO error or -- for other reasons; catch all possible exceptions. - safely a = do - result <- liftIO (try a :: IO (Either SomeException Git.Repo)) - case result of - Left _ -> return r - Right r' -> return r' + safely a = either (const $ return r) return + =<< liftIO (try a :: IO (Either SomeException Git.Repo)) pipedconfig cmd params = safely $ pOpen ReadFromPipe cmd (toCommand params) $ -- cgit v1.2.3