diff options
author | Joey Hess <joey@kitenet.net> | 2012-03-17 00:22:05 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-03-17 00:38:40 -0400 |
commit | a362c46b70c45872ff8c479ba5a6716cf13cc8d8 (patch) | |
tree | e8f08204dc679a1d7c23b5cd466606e7877a2469 /Remote/Git.hs | |
parent | d6624b6c798df401eb9e715810537d2b93935a76 (diff) |
fun with symbols
Nothing at all on hackage is using <&&> or <||>.
(Also, <&&> should short-circuit on failure.)
Diffstat (limited to 'Remote/Git.hs')
-rw-r--r-- | Remote/Git.hs | 9 |
1 files changed, 3 insertions, 6 deletions
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) $ |