Skip to content

Commit

Permalink
using the original list code.
Browse files Browse the repository at this point in the history
  • Loading branch information
kazu-yamamoto committed Sep 3, 2024
1 parent 795cebb commit 80fadc1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Network/Socket/Info.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -317,16 +317,16 @@ followAddrInfo ptr_ai
| otherwise = do
a <- peek ptr_ai
ptr <- (# peek struct addrinfo, ai_next) ptr_ai
go ptr a
(a :|) <$> go ptr
where
go :: Ptr AddrInfo -> AddrInfo -> IO (NonEmpty AddrInfo)
go ptr a
| ptr == nullPtr = return $ NE.singleton a
go :: Ptr AddrInfo -> IO [AddrInfo]
go ptr
| ptr == nullPtr = return []
| otherwise = do
a' <- peek ptr
ptr' <- (# peek struct addrinfo, ai_next) ptr
as <- go ptr' a'
return $ NE.cons a as
as' <- go ptr'
return (a':as')

foreign import ccall safe "hsnet_getaddrinfo"
c_getaddrinfo :: CString -> CString -> Ptr AddrInfo -> Ptr (Ptr AddrInfo)
Expand Down

0 comments on commit 80fadc1

Please sign in to comment.