Skip to content

Commit 1c11e49

Browse files
committed
use HostName rather than String, and move those aliases into Types.hsc
1 parent 65b9b0b commit 1c11e49

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
@@ -289,6 +291,13 @@ type ProtocolNumber = CInt
289291
defaultProtocol :: ProtocolNumber
290292
defaultProtocol = 0
291293

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

@@ -1056,7 +1065,7 @@ type ScopeID = Word32
10561065
--
10571066
-- See also 'Network.Socket.socketFromEndpoint'.
10581067
data SockEndpoint
1059-
= EndpointByName !String !PortNumber
1068+
= EndpointByName !HostName !PortNumber
10601069
| EndpointByAddr !SockAddr
10611070
deriving (Eq, Ord)
10621071

0 commit comments

Comments
 (0)