Module

URI.Host.RegName

Package
purescript-uri
Repository
slamdata/purescript-uri

#RegName Source

newtype RegName

The reg-name variation of the host part of a URI. A reg-name is probably more commonly referred to as just a host name or domain name (but it is actually a name, rather than an IP address).

Instances

#fromString Source

fromString :: NonEmptyString -> RegName

Constructs a reg-name value from a string, percent-encoding any characters that require it. Note that running this on a string that has already had percent-encoding applied will double-encode it, for those situations use unsafeFromString instead.

fromString "foo.com" = unsafeFromString "foo.com"
fromString "foo:bar" = unsafeFromString "foo%3Abar"
fromString "foo%3Abar" = unsafeFromString "foo%253Abar"

#toString Source

toString :: RegName -> NonEmptyString

Returns the string value for a reg-name, percent-decoding any characters that require it.

toString (unsafeFromString "foo.com") = "foo.com"
toString (unsafeFromString "foo%3Abar") = "foo:bar"

#unsafeFromString Source

unsafeFromString :: NonEmptyString -> RegName

Constructs a query value from a string directly - no percent-encoding will be applied. This is useful when using a custom encoding scheme for the query, to prevent double-encoding.

#unsafeToString Source

unsafeToString :: RegName -> NonEmptyString

Returns the string value for the reg-name without percent-decoding. Only "unsafe" in the sense that values this produces may need further decoding, the name is more for symmetry with the fromString/unsafeFromString pairing.

#parser Source

parser :: Parser String RegName

A parser for reg-names.

#print Source

print :: RegName -> String

A printer for reg-names.

#regNameChar Source

regNameChar :: Parser String Char

The supported reg-name characters, excluding percent-encodings.