validity-network-uri-0.0.0.1: Validity instances for URI
Safe HaskellNone
LanguageHaskell2010

Data.Validity.URI

Description

Validity instances for URI and URIAuth

The main API of this module is in the orphan instances Validity URI and Validity URIAuth.

RFC 3986, section 3

Synopsis

Helper functions

dangerousURIToString :: URI -> String Source #

Render a URI to a String, for use in testing

This uses uriToString id as the docs specify. It potentially exposes passwords, so only use it if you know what you're doing.

dangerousDetailedURIToString :: URI -> String Source #

Render a URI to a String, for use in debugging.

This uses custom string juggling. It's what happened when you don't derive show but instead write your own show function. :( It potentially exposes passwords, so only use it if you know what you're doing.

Export everything for testing, **You probably do not want to use any of the functions below**.

dangerousURIToString :: URI -> String Source #

Render a URI to a String, for use in testing

This uses uriToString id as the docs specify. It potentially exposes passwords, so only use it if you know what you're doing.

dangerousDetailedURIToString :: URI -> String Source #

Render a URI to a String, for use in debugging.

This uses custom string juggling. It's what happened when you don't derive show but instead write your own show function. :( It potentially exposes passwords, so only use it if you know what you're doing.

validateUserInfo :: String -> Validation Source #

Validate the uriUserInfo part of an URI

NOTE: Watch out with using this validation separately, it may not reject enough.

RFC 3986, section 3.2.1

userinfo    = *( unreserved  pct-encoded  sub-delims / ":" )

validateHost :: String -> Validation Source #

Validate the uriRegName part of an URI

NOTE: Watch out with using this validation separately, it may not reject enough.

RFC 3986, section 3.2.2 host = IP-literal IPv4address reg-name

IP-literal = "[" ( IPv6address / IPvFuture  ) "]"

IPvFuture  = "v" 1*HEXDIG "." 1*( unreserved  sub-delims  ":" )
reg-name    = *( unreserved  pct-encoded  sub-delims )

validatePort :: String -> Validation Source #

Validate the uriPort part of an URI

NOTE: Watch out with using this validation separately, it may not reject enough.

RFC 3986, section 3.2.3 port = *DIGIT

NOTE: The spec does not specify a maximum length of ports so we do not validate this either.

validateScheme :: String -> Validation Source #

Validate the uriScheme part of an URI

NOTE: Watch out with using this validation separately, it may not reject enough.

RFC 3986, section 3.1 scheme = ALPHA *( ALPHA DIGIT "+" "-" "." )

validatePath :: String -> Validation Source #

Validate the uriPath part of an URI

NOTE: Watch out with using this validation separately, it may not reject enough.

validateQuery :: String -> Validation Source #

Validate the uriQuery part of an URI

NOTE: Watch out with using this validation separately, it may not reject enough.

Orphan instances

Validity URI Source # 
Instance details

Methods

validate :: URI -> Validation #

Validity URIAuth Source # 
Instance details