Skip to content

Commit 34bbbfe

Browse files
Update Network/Socket/Info.hsc
Co-authored-by: endgame <[email protected]>
1 parent e32a05e commit 34bbbfe

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Network/Socket/Info.hsc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,15 @@ class GetAddrInfo t where
207207
-- | Resolve a host or service name to one or more addresses.
208208
-- The 'AddrInfo' values that this function returns contain 'SockAddr'
209209
-- values that you can pass directly to 'connect' or
210-
-- 'bind'. Instances for the hidden 'GetAddrInfo' class are lists and
211-
-- 'NonEmpty' only. Use of 'NonEmpty' is recommended as getaddrinfo() never
212-
-- returns an empty list.
210+
-- 'bind'.
211+
--
212+
-- This function calls @getaddrinfo(3)@, which never successfully returns
213+
-- with an empty list. If the query fails, 'getAddrInfo' throws an IO
214+
-- exception.
215+
--
216+
-- For backwards-compatibility reasons, a hidden 'GetAddrInfo' class is used
217+
-- to make the result polymorphic. It only has instances for @[]@ (lists)
218+
-- and 'NonEmpty' only. Use of 'NonEmpty' is recommended.
213219
--
214220
-- This function is protocol independent. It can return both IPv4 and
215221
-- IPv6 address information.
@@ -230,10 +236,6 @@ class GetAddrInfo t where
230236
-- a hint, network addresses in the result will contain the address of
231237
-- the loopback interface.
232238
--
233-
-- If the query fails, this function throws an IO exception instead of
234-
-- returning an empty list. Otherwise, it returns a non-empty list
235-
-- of 'AddrInfo' values.
236-
--
237239
-- There are several reasons why a query might result in several
238240
-- values. For example, the queried-for host could be multihomed, or
239241
-- the service might be available via several protocols.

0 commit comments

Comments
 (0)