Module

URI.HostPortPair

Package
purescript-uri
Repository
purescript-contrib/purescript-uri

#HostPortPair Source

type HostPortPair host port = Maybe (These host port)

A spec-conformant host/port pair (may also be empty). For example: purescript.org, localhost:3000, :9000.

#parser Source

parser :: forall host port. (Host -> Either URIPartParseError host) -> (Port -> Either URIPartParseError port) -> Parser String (HostPortPair host port)

A parser for a spec-conformant host/port pair.

This function allows for the Host and Port components to be parsed into custom representations. If this is not necessary, use pure for both of these arguments.

Host parsing is dealt with a little differently to all the other URI components, as for hosts the control is passed entirely to the component parser. This is to accomodate multi-host URIs that are used sometimes for connection strings and the like, but as these are not spec-conforming this part of parsing may need to bend the rules a little. See URI.Extra.MultiHostPortPair for an example of this.

#print Source

print :: forall host port. (host -> Host) -> (port -> Port) -> HostPortPair host port -> String

A printer for a spec-conformant host/port pair.

As a counterpart to the parser this function also requires the Host and Port components to be printed back from their custom representations. If no custom types are being used, pass identity for both of these arguments.