From 1c11e49bd5bc395e469c841058e66d7e35fa7a2f Mon Sep 17 00:00:00 2001 From: Ximin Luo Date: Wed, 27 May 2020 11:47:44 +0100 Subject: [PATCH] use HostName rather than String, and move those aliases into Types.hsc --- Network/Socket/Info.hsc | 9 --------- Network/Socket/Types.hsc | 11 ++++++++++- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Network/Socket/Info.hsc b/Network/Socket/Info.hsc index 4fe0950c..283c7a05 100644 --- a/Network/Socket/Info.hsc +++ b/Network/Socket/Info.hsc @@ -20,15 +20,6 @@ import Network.Socket.Internal import Network.Socket.Syscall (socket) import Network.Socket.Types ------------------------------------------------------------------------------ - --- | Either a host name e.g., @\"haskell.org\"@ or a numeric host --- address string consisting of a dotted decimal IPv4 address or an --- IPv6 address e.g., @\"192.168.0.1\"@. -type HostName = String --- | Either a service name e.g., @\"http\"@ or a numeric port number. -type ServiceName = String - ----------------------------------------------------------------------------- -- Address and service lookups diff --git a/Network/Socket/Types.hsc b/Network/Socket/Types.hsc index 25b0c74c..34ea987d 100644 --- a/Network/Socket/Types.hsc +++ b/Network/Socket/Types.hsc @@ -74,6 +74,8 @@ module Network.Socket.Types ( , defaultProtocol , PortNumber , defaultPort + , HostName + , ServiceName -- * Low-level helpers , zeroMemory @@ -289,6 +291,13 @@ type ProtocolNumber = CInt defaultProtocol :: ProtocolNumber defaultProtocol = 0 +-- | Either a host name e.g., @\"haskell.org\"@ or a numeric host +-- address string consisting of a dotted decimal IPv4 address or an +-- IPv6 address e.g., @\"192.168.0.1\"@. +type HostName = String +-- | Either a service name e.g., @\"http\"@ or a numeric port number. +type ServiceName = String + ----------------------------------------------------------------------------- -- Socket types @@ -1056,7 +1065,7 @@ type ScopeID = Word32 -- -- See also 'Network.Socket.socketFromEndpoint'. data SockEndpoint - = EndpointByName !String !PortNumber + = EndpointByName !HostName !PortNumber | EndpointByAddr !SockAddr deriving (Eq, Ord)