Skip to content

Commit 364b4a6

Browse files
committed
use HostName rather than String, and move those aliases into Types.hsc
1 parent b6c9ef5 commit 364b4a6

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

Network/Socket/Info.hsc

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ import Network.Socket.Internal
2020
import Network.Socket.Syscall (socket)
2121
import Network.Socket.Types
2222

23-
-----------------------------------------------------------------------------
24-
25-
-- | Either a host name e.g., @\"haskell.org\"@ or a numeric host
26-
-- address string consisting of a dotted decimal IPv4 address or an
27-
-- IPv6 address e.g., @\"192.168.0.1\"@.
28-
type HostName = String
29-
-- | Either a service name e.g., @\"http\"@ or a numeric port number.
30-
type ServiceName = String
31-
3223
-----------------------------------------------------------------------------
3324
-- Address and service lookups
3425

Network/Socket/Types.hsc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ module Network.Socket.Types (
7474
, defaultProtocol
7575
, PortNumber
7676
, defaultPort
77+
, HostName
78+
, ServiceName
7779

7880
-- * Low-level helpers
7981
, zeroMemory
@@ -291,6 +293,13 @@ type ProtocolNumber = CInt
291293
defaultProtocol :: ProtocolNumber
292294
defaultProtocol = 0
293295

296+
-- | Either a host name e.g., @\"haskell.org\"@ or a numeric host
297+
-- address string consisting of a dotted decimal IPv4 address or an
298+
-- IPv6 address e.g., @\"192.168.0.1\"@.
299+
type HostName = String
300+
-- | Either a service name e.g., @\"http\"@ or a numeric port number.
301+
type ServiceName = String
302+
294303
-----------------------------------------------------------------------------
295304
-- Socket types
296305

@@ -1062,7 +1071,7 @@ type ScopeID = Word32
10621071
--
10631072
-- See also 'Network.Socket.socketFromEndpoint'.
10641073
data SockEndpoint
1065-
= EndpointByName !String !PortNumber
1074+
= EndpointByName !HostName !PortNumber
10661075
| EndpointByAddr !SockAddr
10671076
deriving (Eq, Ord)
10681077

0 commit comments

Comments
 (0)