Skip to content

Commit

Permalink
use HostName rather than String, and move those aliases into Types.hsc
Browse files Browse the repository at this point in the history
  • Loading branch information
infinity0 committed Nov 17, 2020
1 parent b6c9ef5 commit 364b4a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
9 changes: 0 additions & 9 deletions Network/Socket/Info.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 10 additions & 1 deletion Network/Socket/Types.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ module Network.Socket.Types (
, defaultProtocol
, PortNumber
, defaultPort
, HostName
, ServiceName

-- * Low-level helpers
, zeroMemory
Expand Down Expand Up @@ -291,6 +293,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

Expand Down Expand Up @@ -1062,7 +1071,7 @@ type ScopeID = Word32
--
-- See also 'Network.Socket.socketFromEndpoint'.
data SockEndpoint
= EndpointByName !String !PortNumber
= EndpointByName !HostName !PortNumber
| EndpointByAddr !SockAddr
deriving (Eq, Ord)

Expand Down

0 comments on commit 364b4a6

Please sign in to comment.