Module

URI.URIRef

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

#URIRef Source

type URIRef userInfo hosts path hierPath relPath query fragment = Either (URI userInfo hosts path hierPath query fragment) (RelativeRef userInfo hosts path relPath query fragment)

The most general kind of URI, can either be relative or absolute.

#URIRefOptions Source

type URIRefOptions userInfo hosts path hierPath relPath query fragment = URIRefParseOptions userInfo hosts path hierPath relPath query fragment (URIRefPrintOptions userInfo hosts path hierPath relPath query fragment ())

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

Used as Record (URIRefOptions userInfo hosts path hierPath relPath query fragment) when type anotating an options record.

See below for details of how to use these configuration options.

#URIRefParseOptions Source

type URIRefParseOptions userInfo hosts path hierPath relPath query fragment r = (parseFragment :: Fragment -> Either URIPartParseError fragment, parseHierPath :: Either PathAbsolute PathRootless -> Either URIPartParseError hierPath, parseHosts :: Parser String hosts, parsePath :: Path -> Either URIPartParseError path, parseQuery :: Query -> Either URIPartParseError query, parseRelPath :: Either PathAbsolute PathNoScheme -> Either URIPartParseError relPath, parseUserInfo :: UserInfo -> Either URIPartParseError userInfo | r)

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

Used as Record (URIRefParseOptions userInfo hosts path hierPath relPath query fragment ()) when type anotating an options record.

Having this options record allows custom representations to be used for the URI components. If this is not necessary, pure can be used for all the options aside from parseHosts, which will typically be HostPortPair.parseHosts pure pure. See URI.HostPortPair for more information on the host/port pair parser.

#URIRefPrintOptions Source

type URIRefPrintOptions userInfo hosts path hierPath relPath query fragment r = (printFragment :: fragment -> Fragment, printHierPath :: hierPath -> Either PathAbsolute PathRootless, printHosts :: hosts -> String, printPath :: path -> Path, printQuery :: query -> Query, printRelPath :: relPath -> Either PathAbsolute PathNoScheme, printUserInfo :: userInfo -> UserInfo | r)

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

Used as Record (URIRefPrintOptions userInfo hosts path hierPath relPath query fragment ()) when type anotating an options record.

As a reverse of the parse options, this specifies how to print values back from custom representations. If this is not necessary, id can be used for all the options aside from printHosts, which will typically be HostPortPair.printHosts id id. See URI.HostPortPair for more information on the host/port pair printer.

#parser Source

parser :: forall userInfo hosts path hierPath relPath query fragment r. Record (URIRefParseOptions userInfo hosts path hierPath relPath query fragment r) -> Parser String (URIRef userInfo hosts path hierPath relPath query fragment)

A parser for a general URI.

#print Source

print :: forall userInfo hosts path hierPath relPath query fragment r. Record (URIRefPrintOptions userInfo hosts path hierPath relPath query fragment r) -> URIRef userInfo hosts path hierPath relPath query fragment -> String

A printer for a general URI.

Re-exports from URI.Authority

#Authority Source

data Authority userInfo hosts

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

Constructors

Instances

Re-exports from URI.Fragment

#Fragment Source

newtype Fragment

The fragment component (hash) of a URI.

Instances

Re-exports from URI.Host

#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

#IPv6Address Source

newtype IPv6Address

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

Instances

#IPv4Address Source

data IPv4Address

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

Instances

#Host Source

data Host

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

Constructors

Instances

#_NameAddress Source

_NameAddress :: Prism' Host RegName

A prism for the NameAddress constructor.

#_IPv6Address Source

_IPv6Address :: Prism' Host IPv6Address

A prism for the IPv6Address constructor.

#_IPv4Address Source

_IPv4Address :: Prism' Host IPv4Address

A prism for the IPv4Address constructor.

Re-exports from URI.Path

#Path Source

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 [].

Constructors

Instances

Re-exports from URI.Path.Absolute

#PathAbsolute Source

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!

Constructors

Instances

Re-exports from URI.Path.NoScheme

#PathNoScheme Source

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.

Constructors

Instances

Re-exports from URI.Path.Rootless

#PathRootless Source

newtype PathRootless

A relative path, corresponding to path-rootless in the spec. This path cannot start with the character / or be entirely empty. This type can appear in a hierarchical-part when there is no authority component.

Constructors

Instances

Re-exports from URI.Port

#Port Source

newtype Port

The port component of a host in a URI.

Instances

Re-exports from URI.Query

#Query Source

newtype Query

The query component of a URI.

This type treats the entire string as an undifferentiated blob, if you would like to deal with the common ?key1=value1&key2=value2 format, take a look at URI.Extra.QueryPairs.

Instances

Re-exports from URI.RelativeRef

#RelativeRef Source

data RelativeRef userInfo hosts path relPath query fragment

A relative URI. Relative in the sense that it lacks a Scheme component.

Constructors

Instances

#RelativePart Source

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

#RelPath Source

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.

Re-exports from URI.Scheme

#Scheme Source

newtype Scheme

The scheme part of an absolute URI. For example: http, ftp, git.

Instances

Re-exports from URI.URI

#URI Source

data URI userInfo hosts path hierPath query fragment

A general purpose absolute URI - similar to AbsoluteURI but also admits a fragment component. An absolute URI can still contain relative paths but is required to have a Scheme component.

Constructors

Instances

  • (Eq userInfo, Eq hosts, Eq path, Eq hierPath, Eq query, Eq fragment) => Eq (URI userInfo hosts path hierPath query fragment)
  • (Ord userInfo, Ord hosts, Ord path, Ord hierPath, Ord query, Ord fragment) => Ord (URI userInfo hosts path hierPath query fragment)
  • Generic (URI userInfo hosts path hierPath query fragment) _
  • (Show userInfo, Show hosts, Show path, Show hierPath, Show query, Show fragment) => Show (URI userInfo hosts path hierPath query fragment)

#HierarchicalPart Source

data HierarchicalPart userInfo hosts path hierPath

The "hierarchical part" of a generic or absolute URI. 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

#HierPath Source

type HierPath = Either PathAbsolute PathRootless

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

Re-exports from URI.UserInfo

#UserInfo Source

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