diff options
author | Joey Hess <joey@kitenet.net> | 2012-09-17 00:18:07 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-09-17 00:18:07 -0400 |
commit | e8188ea611e4c9223492203c0ec0370c3c45b225 (patch) | |
tree | 2a078993be28d1dedc38f8ab9ad193eea0ecf90e /Assistant | |
parent | ba744c84a4f683e50bf4c9b8c388e3a611f7fb91 (diff) |
flip catchDefaultIO
Diffstat (limited to 'Assistant')
-rw-r--r-- | Assistant/DaemonStatus.hs | 2 | ||||
-rw-r--r-- | Assistant/Pairing/MakeRemote.hs | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/Assistant/DaemonStatus.hs b/Assistant/DaemonStatus.hs index cbd606680..11ea8676d 100644 --- a/Assistant/DaemonStatus.hs +++ b/Assistant/DaemonStatus.hs @@ -108,7 +108,7 @@ startDaemonStatus :: Annex DaemonStatusHandle startDaemonStatus = do file <- fromRepo gitAnnexDaemonStatusFile status <- liftIO $ - catchDefaultIO (readDaemonStatusFile file) =<< newDaemonStatus + flip catchDefaultIO (readDaemonStatusFile file) =<< newDaemonStatus transfers <- M.fromList <$> getTransfers remotes <- calcKnownRemotes liftIO $ atomically $ newTMVar status diff --git a/Assistant/Pairing/MakeRemote.hs b/Assistant/Pairing/MakeRemote.hs index f3c5e0d50..fae8c5ee3 100644 --- a/Assistant/Pairing/MakeRemote.hs +++ b/Assistant/Pairing/MakeRemote.hs @@ -78,7 +78,8 @@ bestHostName :: PairMsg -> IO HostName bestHostName msg = case remoteHostName $ pairMsgData msg of Just h -> do let localname = h ++ ".local" - addrs <- catchDefaultIO (getAddrInfo Nothing (Just localname) Nothing) [] + addrs <- catchDefaultIO [] $ + getAddrInfo Nothing (Just localname) Nothing maybe fallback (const $ return localname) (headMaybe addrs) Nothing -> fallback where @@ -88,4 +89,5 @@ bestHostName msg = case remoteHostName $ pairMsgData msg of IPv4Addr addr -> SockAddrInet (PortNum 0) addr IPv6Addr addr -> SockAddrInet6 (PortNum 0) 0 addr 0 fromMaybe (showAddr a) - <$> catchDefaultIO (fst <$> getNameInfo [] True False sockaddr) Nothing + <$> catchDefaultIO Nothing + (fst <$> getNameInfo [] True False sockaddr) |