Module

URI.RelativePart

#RelativePart

data RelativePart userInfo hosts path relPath

The "relative part" of a relative reference. This combines an authority (optional) with a path value.

When the authority is present a generic path representation can be used, otherwise there are some restrictions on the path construction to ensure no ambiguity in parsing (this is per the spec, not a restriction of the library).

Constructors

Instances

#RelativePartOptions

type RelativePartOptions :: Type -> Type -> Type -> Type -> Row Typetype RelativePartOptions userInfo hosts path relPath = RelativePartParseOptions userInfo hosts path relPath (RelativePartPrintOptions userInfo hosts path relPath ())

A row type for describing the options fields used by the relative-part parser and printer.

Used as Record (RelativePartOptions userInfo hosts path relPath) when type annotating an options record.

#RelativePartParseOptions

type RelativePartParseOptions :: Type -> Type -> Type -> Type -> Row Type -> Row Typetype RelativePartParseOptions userInfo hosts path relPath r = (parseHosts :: Parser String hosts, parsePath :: Path -> Either URIPartParseError path, parseRelPath :: RelPath -> Either URIPartParseError relPath, parseUserInfo :: UserInfo -> Either URIPartParseError userInfo | r)

A row type for describing the options fields used by the relative-part parser.

Used as Record (RelativePartParseOptions userInfo hosts path relPath ()) when type annotating an options record.

#RelativePartPrintOptions

type RelativePartPrintOptions :: Type -> Type -> Type -> Type -> Row Type -> Row Typetype RelativePartPrintOptions userInfo hosts path relPath r = (printHosts :: hosts -> String, printPath :: path -> Path, printRelPath :: relPath -> RelPath, printUserInfo :: userInfo -> UserInfo | r)

A row type for describing the options fields used by the relative-part printer.

Used as Record (RelativePartPrintOptions userInfo hosts path relPath ()) when type annotating an options record.

#RelPath

type RelPath = Either PathAbsolute PathNoScheme

The specific path types supported in a relative-part when there is no authority present. See URI.Path.Absolute and URI.Path.PathNoScheme for an explanation of these forms.

#parser

parser :: forall userInfo hosts path relPath r. Record (RelativePartParseOptions userInfo hosts path relPath r) -> Parser String (RelativePart userInfo hosts path relPath)

A parser for the relative-part of a URI.

#print

print :: forall userInfo hosts path relPath r. Record (RelativePartPrintOptions userInfo hosts path relPath r) -> RelativePart userInfo hosts path relPath -> String

A printer for the relative-part of a URI.

#_authority

_authority :: forall userInfo hosts path relPath. Traversal' (RelativePart userInfo hosts path relPath) (Authority userInfo hosts)

An affine traversal for the authority component of a relative-part.

#_path

_path :: forall userInfo hosts path relPath. Traversal' (RelativePart userInfo hosts path relPath) path

An affine traversal for the path component of a relative-part, this succeeds when the authority is present also.

#_relPath

_relPath :: forall userInfo hosts path relPath. Traversal' (RelativePart userInfo hosts path relPath) (Maybe relPath)

An affine traversal for the path component of a relative-part, this succeeds when the authority is not present.

Re-exports from URI.Authority

#UserInfo

newtype UserInfo

The user info part of an Authority. For example: user, foo:bar.

This type treats the entire string as an undifferentiated blob, if you would like to specifically deal with the user:password format, take a look at URI.Extra.UserPassInfo.

Instances

#RegName

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

#Port

newtype Port

The port component of a host in a URI.

Instances

#IPv6Address

newtype IPv6Address

This type and parser are much too forgiving currently, allowing almost anything through that looks vaguely IPv6ish.

Instances

#IPv4Address

data IPv4Address

The IPv4 address variation of the host part of a URI.

Instances

#Host

data Host

A host address. Supports named addresses, IPv4, and IPv6.

Constructors

Instances

#AuthorityPrintOptions

type AuthorityPrintOptions :: Type -> Type -> Row Type -> Row Typetype AuthorityPrintOptions userInfo hosts r = (printHosts :: hosts -> String, printUserInfo :: userInfo -> UserInfo | r)

A row type for describing the options fields used by the authority printer.

Used as Record (AuthorityPrintOptions userInfo hosts ()) when type annotating an options record.

#AuthorityParseOptions

type AuthorityParseOptions :: Type -> Type -> Row Type -> Row Typetype AuthorityParseOptions userInfo hosts r = (parseHosts :: Parser String hosts, parseUserInfo :: UserInfo -> Either URIPartParseError userInfo | r)

A row type for describing the options fields used by the authority parser.

Used as Record (AuthorityParseOptions userInfo hosts ()) when type annotating an options record.

#AuthorityOptions

type AuthorityOptions :: Type -> Type -> Row Typetype AuthorityOptions userInfo hosts = AuthorityParseOptions userInfo hosts (AuthorityPrintOptions userInfo hosts ())

A row type for describing the options fields used by the authority parser and printer.

Used as Record (AuthorityOptions userInfo hosts) when type annotating an options record.

#Authority

data Authority userInfo hosts

The authority part of a URI. For example: purescript.org, localhost:3000, user@example.net.

Constructors

Instances

#_userInfo

_userInfo :: forall userInfo hosts. Lens' (Authority userInfo hosts) (Maybe userInfo)

A lens for the user-info component of the authority.

#_hosts

_hosts :: forall userInfo hosts. Lens' (Authority userInfo hosts) hosts

A lens for the host(s) component of the authority.

#_NameAddress

_NameAddress :: Prism' Host RegName

A prism for the NameAddress constructor.

#_IPv6Address

_IPv6Address :: Prism' Host IPv6Address

A prism for the IPv6Address constructor.

#_IPv4Address

_IPv4Address :: Prism' Host IPv4Address

A prism for the IPv4Address constructor.

Re-exports from URI.Path

#Path

newtype Path

A generic absolute-or-empty path, used in both hierarchical-part and relative-parts when an authority component is present. Corresponds to path-abempty in the spec.

A path value of / corresponds to Path [""], an empty path is Path [].

Instances

Re-exports from URI.Path.Absolute

#PathAbsolute

newtype PathAbsolute

An absolute path, corresponding to path-absolute in the spec. This path cannot represent the value // - it must either be /, or start with a segment that is not empty, for example: /something, /., /... This type can appear in both hierarchical-part and relative-parts to represent an absolute path when no authority component is present.

This restriction exists as a value begining with // at this point in the grammar must be an authority, attempting to decide whether a value is an authority or a path would be ambiguous if // paths were allowed. The // path means the same thing as / anyway!

Instances

Re-exports from URI.Path.NoScheme

#PathNoScheme

newtype PathNoScheme

A relative path that doesn't look like a URI scheme, corresponding to path-noscheme in the spec. This path cannot start with the character /, contain the character : before the first /, or be entirely empty. This type can appear in a relative-part when there is no authority component.

Instances

Modules