Module

URI.Extra.MultiHostPortPair

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

#MultiHostPortPair Source

type MultiHostPortPair host port = Array (These host port)

Multi-host/port pairs, where host & port combinations can be separated by ,, as used by some connection URI schemes. This is not strictly compatible with RFC 3986, as in that spec RegNames can contain ,, and only one port can be specified in the authority.

A motivating example for where this may be useful: dealing with mongodb connection strings.

#parser Source

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

A parser for multiple host/port pairs embedded in a URI.

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.

#print Source

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

A printer for multiple host/port pairs embedded in a URI.

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.