HORIZON HASKELLDocslts/ghc-10.0.x2b276322026-10-31Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 2b27632 · 2026-10-31

ModuleHTTP-4000.5.0Haskell98

Network.TCP

Some utility functions for working with the Haskell network package. Mostly for internal use by the Network.HTTP code.

Synopsis
  • PackageHTTP-4000.5.0
  • Exports14
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceTCP.hs
newtypenewtype Connection

The Connection newtype is a wrapper that allows us to make connections an instance of the Stream class, without GHC extensions. While this looks sort of like a generic reference to the transport layer it is actually TCP specific, which can be seen in the implementation of the 'Stream Connection' instance.

Instances1Stream

openTCPPort uri port establishes a connection to a remote host, using getHostByName which possibly queries the DNS system, hence may trigger a network connection.

classclass BufferType bufType => HStream bufType where

HStream overloads the use of HandleStreams, letting you overload the handle operations over the type that is communicated across the handle. It comes in handy for Network.HTTP Request and Responses as the payload representation isn't fixed, but overloaded.

The library comes with instances for ByteStrings and String, but should you want to plug in your own payload representation, defining your own HStream instance _should_ be all that it takes.

Methods

Instances3HStream