Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactored error handling in .@.

  • Loading branch information...
commit 591bb077043592cc4d1bff0127f4b6ee61cf286e 1 parent 321927f
Cetin Sert authored
Showing with 3 additions and 3 deletions.
  1. +1 −0  .gitignore
  2. +2 −3 src/Main.hs
View
1  .gitignore
@@ -1,3 +1,4 @@
*.hi
*.o
+*.swp
dist/
View
5 src/Main.hs
@@ -115,12 +115,11 @@ a @>-<@ b =
(<@) s = do (c,_) <- accept s; configure c; print . (:.:) Accept =<< (c <@>); return c
(.@.) :: Host -> Port -> IO Socket
-h .@. p = do -- (X.throwIO (e Nothing) ???) . map c =<< getAddrInfo hint host port
- as <- getAddrInfo hint host port
- X.throwIO (Silence $ map addrAddress as) ??? map c as
+h .@. p = getAddrInfo hint host port >>= \as -> e as ??? map c as
where hint = Just $! defaultHints { addrSocketType = Stream }
host = Just $! B.unpack h
port = Just $! show p
+ e as = X.throwIO . Silence $ map addrAddress as
c a = do s <- socket (addrFamily a) Stream 0x6 =>> configure
r <- s `connect` addrAddress a // timeout (secs 3)
case r of
Please sign in to comment.
Something went wrong with that request. Please try again.