HORIZON HASKELLDocslts/ghc-9.14.x99ffbb82026-10-19Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 99ffbb8 · 2026-10-19

  • Packagesocket-0.8.3.0
  • Exports16
  • LanguageHaskell2010
  • LicenceMIT
  • SourceInet.hsc

Inet

datadata Inet
Instances7HasAddressInfo, HasNameInfo, Family, Eq, Show, Storable, …

InetAddress

newtypenewtype InetAddress

To avoid errors with endianess it was decided to keep this type abstract.

Use inetAddressFromTuple and inetAddressToTuple for constructing and deconstructing custom addresses.

Hint: Use the Storable instance. It exposes it exactly as found within an IP packet (big endian if you insist on interpreting it as a number).

Another hint: Use getAddressInfo for parsing and suppress nameserver lookups:

> getAddressInfo (Just "127.0.0.1") Nothing aiNumericHost :: IO [AddressInfo Inet Stream TCP]
[AddressInfo {addressInfoFlags = AddressInfoFlags 4, socketAddress = SocketAddressInet {inetAddress = InetAddress 127.0.0.1, inetPort = InetPort 0}, canonicalName = Nothing}]
Instances3Eq, Show, Storable

InetPort

newtypenewtype InetPort
#
Instances8Enum, Eq, Integral, Num, Ord, Real, …
  • Enum InetPortDefined in socket-0.8.3.0 · System.Socket.Family.Inet
  • Eq InetPortDefined in socket-0.8.3.0 · System.Socket.Family.Inet
  • Integral InetPortDefined in socket-0.8.3.0 · System.Socket.Family.Inet
  • Num InetPortDefined in socket-0.8.3.0 · System.Socket.Family.Inet
  • Ord InetPortDefined in socket-0.8.3.0 · System.Socket.Family.Inet
  • Real InetPortDefined in socket-0.8.3.0 · System.Socket.Family.Inet
  • Show InetPortDefined in socket-0.8.3.0 · System.Socket.Family.Inet
  • Storable InetPortDefined in socket-0.8.3.0 · System.Socket.Family.Inet
familydata family SocketAddress f

The SocketAddress type is a data family. This allows to provide different data constructors depending on the socket family without knowing all of them in advance or the need to extend this core library.

SocketAddressInet  inetLoopback  8080     :: SocketAddress Inet
SocketAddressInet6 inet6Loopback 8080 0 0 :: SocketAddress Inet6
Instances8Eq, Show, Storable, SocketAddress, …

Custom addresses

inetAddressFromTuple

inetAddressToTuple

Special addresses

inetAllHostsGroup

inetAny

inetBroadcast

inetLoopback

inetMaxLocalGroup

inetNone

inetUnspecificGroup