URI.RelativeRef
- Package
- purescript-uri
- Repository
- purescript-contrib/purescript-uri
#RelativeRef Source
data RelativeRef userInfo hosts path relPath query fragment
A relative URI. Relative in the sense that it lacks a Scheme
component.
Constructors
RelativeRef (RelativePart userInfo hosts path relPath) (Maybe query) (Maybe fragment)
Instances
(Eq userInfo, Eq hosts, Eq path, Eq relPath, Eq query, Eq fragment) => Eq (RelativeRef userInfo hosts path relPath query fragment)
(Ord userInfo, Ord hosts, Ord path, Ord relPath, Ord query, Ord fragment) => Ord (RelativeRef userInfo hosts path relPath query fragment)
Generic (RelativeRef userInfo hosts path relPath query fragment) _
(Show userInfo, Show hosts, Show path, Show relPath, Show query, Show fragment) => Show (RelativeRef userInfo hosts path relPath query fragment)
#RelativeRefOptions Source
type RelativeRefOptions :: Type -> Type -> Type -> Type -> Type -> Type -> Row Type
type RelativeRefOptions userInfo hosts path relPath query fragment = RelativeRefParseOptions userInfo hosts path relPath query fragment (RelativeRefPrintOptions userInfo hosts path relPath query fragment ())
A row type for describing the options fields used by the relative URI parser and printer.
Used as Record (RelativeRefOptions userInfo hosts path relPath query fragment)
when type anotating an options record.
See below for details of how to use these configuration options.
#RelativeRefParseOptions Source
type RelativeRefParseOptions :: Type -> Type -> Type -> Type -> Type -> Type -> Row Type -> Row Type
type RelativeRefParseOptions userInfo hosts path relPath query fragment r = (parseFragment :: Fragment -> Either URIPartParseError fragment, 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 relative URI parser.
Used as Record (RelativeRefParseOptions userInfo hosts path 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.
#RelativeRefPrintOptions Source
type RelativeRefPrintOptions :: Type -> Type -> Type -> Type -> Type -> Type -> Row Type -> Row Type
type RelativeRefPrintOptions userInfo hosts path relPath query fragment r = (printFragment :: fragment -> Fragment, 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 relative URI printer.
As a reverse of the parse options, this specifies how to print values back
from custom representations. If this is not necessary, identity
can be used for
all the options aside from printHosts
, which will typically be
HostPortPair.printHosts identity identity
. See URI.HostPortPair
for more information on the host/port pair printer.
#parser Source
parser :: forall userInfo hosts path relPath query fragment r. Record (RelativeRefParseOptions userInfo hosts path relPath query fragment r) -> Parser String (RelativeRef userInfo hosts path relPath query fragment)
A parser for a relative URI.
#print Source
print :: forall userInfo hosts path relPath query fragment r. Record (RelativeRefPrintOptions userInfo hosts path relPath query fragment r) -> RelativeRef userInfo hosts path relPath query fragment -> String
A printer for a relative URI.
#_relPart Source
_relPart :: forall userInfo hosts path relPath query fragment. Lens' (RelativeRef userInfo hosts path relPath query fragment) (RelativePart userInfo hosts path relPath)
The relative-part component of a relative URI.
#_query Source
_query :: forall userInfo hosts path relPath query fragment. Lens' (RelativeRef userInfo hosts path relPath query fragment) (Maybe query)
The query component of a relative URI.
#_fragment Source
_fragment :: forall userInfo hosts path relPath query fragment. Lens' (RelativeRef userInfo hosts path relPath query fragment) (Maybe fragment)
The fragment component of a relative URI.
Re-exports from URI.Fragment
Re-exports from URI.Query
Re-exports from URI.RelativePart
#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
#RelativePartPrintOptions Source
type RelativePartPrintOptions :: Type -> Type -> Type -> Type -> Row Type -> Row Type
type 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.
#RelativePartParseOptions Source
type RelativePartParseOptions :: Type -> Type -> Type -> Type -> Row Type -> Row Type
type 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.
#RelativePartOptions Source
type RelativePartOptions :: Type -> Type -> Type -> Type -> Row Type
type 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.
#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
RelativePartAuth (Authority userInfo hosts) path
RelativePartNoAuth (Maybe relPath)
Instances
(Eq userInfo, Eq hosts, Eq path, Eq relPath) => Eq (RelativePart userInfo hosts path relPath)
(Ord userInfo, Ord hosts, Ord path, Ord relPath) => Ord (RelativePart userInfo hosts path relPath)
Generic (RelativePart userInfo hosts path relPath) _
(Show userInfo, Show hosts, Show path, Show relPath) => Show (RelativePart userInfo hosts path relPath)
#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.
#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.
Instances
#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!
Instances
#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 []
.
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
#Host Source
#AuthorityPrintOptions Source
type AuthorityPrintOptions :: Type -> Type -> Row Type -> Row Type
type 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 Source
type AuthorityParseOptions :: Type -> Type -> Row Type -> Row Type
type 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 Source
type AuthorityOptions :: Type -> Type -> Row Type
type 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 Source
data Authority userInfo hosts
The authority part of a URI. For example: purescript.org
,
localhost:3000
, user@example.net
.
Constructors
Instances
#_relPath Source
_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.
#_path Source
_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.
#_authority Source
_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.
#_IPv6Address Source
_IPv6Address :: Prism' Host IPv6Address
A prism for the IPv6Address
constructor.
#_IPv4Address Source
_IPv4Address :: Prism' Host IPv4Address
A prism for the IPv4Address
constructor.
- Modules
- URI
- URI.
AbsoluteURI - URI.
Authority - URI.
Common - URI.
Extra. MultiHostPortPair - URI.
Extra. QueryPairs - URI.
Extra. UserPassInfo - URI.
Fragment - URI.
HierarchicalPart - URI.
Host - URI.
Host. Gen - URI.
Host. IPv4Address - URI.
Host. IPv6Address - URI.
Host. RegName - URI.
HostPortPair - URI.
HostPortPair. Gen - URI.
Path - URI.
Path. Absolute - URI.
Path. NoScheme - URI.
Path. Rootless - URI.
Path. Segment - URI.
Port - URI.
Port. Gen - URI.
Query - URI.
RelativePart - URI.
RelativeRef - URI.
Scheme - URI.
Scheme. Common - URI.
URI - URI.
URIRef - URI.
UserInfo