summaryrefslogtreecommitdiff
path: root/Utility/SRV.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-13 00:24:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-13 00:24:19 -0400
commit94554782894ec6c26da3b46312d5d1d16d596458 (patch)
tree78746106bfb153945ccbfd2bbae536081c005e91 /Utility/SRV.hs
parent55bd61d8c42aaf36a3c57f8444c493f6b045f4cd (diff)
finished where indentation changes
Diffstat (limited to 'Utility/SRV.hs')
-rw-r--r--Utility/SRV.hs38
1 files changed, 19 insertions, 19 deletions
diff --git a/Utility/SRV.hs b/Utility/SRV.hs
index bbfc7276d..9a099089e 100644
--- a/Utility/SRV.hs
+++ b/Utility/SRV.hs
@@ -74,11 +74,11 @@ lookupSRV (SRV srv) = do
r <- withResolver seed $ flip DNS.lookupSRV $ B8.fromString srv
print r
return $ maybe [] (orderHosts . map tohosts) r
- where
- tohosts (priority, weight, port, hostname) =
- ( (priority, weight)
- , (B8.toString hostname, PortNumber $ fromIntegral port)
- )
+ where
+ tohosts (priority, weight, port, hostname) =
+ ( (priority, weight)
+ , (B8.toString hostname, PortNumber $ fromIntegral port)
+ )
#else
lookupSRV = lookupSRVHost
#endif
@@ -93,21 +93,21 @@ lookupSRVHost (SRV srv) = catchDefaultIO [] $
parseSrvHost :: String -> [HostPort]
parseSrvHost = orderHosts . catMaybes . map parse . lines
- where
- parse l = case words l of
- [_, _, _, _, spriority, sweight, sport, hostname] -> do
- let v =
- ( readish sport :: Maybe Int
- , readish spriority :: Maybe Int
- , readish sweight :: Maybe Int
+ where
+ parse l = case words l of
+ [_, _, _, _, spriority, sweight, sport, hostname] -> do
+ let v =
+ ( readish sport :: Maybe Int
+ , readish spriority :: Maybe Int
+ , readish sweight :: Maybe Int
+ )
+ case v of
+ (Just port, Just priority, Just weight) -> Just
+ ( (priority, weight)
+ , (hostname, PortNumber $ fromIntegral port)
)
- case v of
- (Just port, Just priority, Just weight) -> Just
- ( (priority, weight)
- , (hostname, PortNumber $ fromIntegral port)
- )
- _ -> Nothing
- _ -> Nothing
+ _ -> Nothing
+ _ -> Nothing
orderHosts :: [(PriorityWeight, HostPort)] -> [HostPort]
orderHosts = map snd . sortBy (compare `on` fst)