Module

URI.Common

Common functions used in parsing and printing URI components.

#URIPartParseError

newtype URIPartParseError

An error type used when a custom component parser fails to handle a value.

Constructors

Instances

#wrapParser

wrapParser :: forall s m a b. Monad m => (a -> Either URIPartParseError b) -> ParserT s m a -> ParserT s m b

Adapts a parser with a parser-esque function. First the original parser runs, then it attempts to refine the result with the function.

#alpha

alpha :: Parser String Char

Parser for ascii alphabetical characters (upper and lowercase).

#alphaNum

alphaNum :: Parser String Char

Parser for ascii alphanumeric characters (upper and lowercase for letters).

#unreserved

unreserved :: Parser String Char

Parser for characters that are allowed in a URI but do not have a reserved purpose.

#pctEncoded

pctEncoded :: Parser String NonEmptyString

Parser for a percent-encoded character.

#subDelims

subDelims :: Parser String Char

Parser for the "sub-delims" group of reserved characters.

#printEncoded

printEncoded :: Parser String Char -> String -> String

A helper function for printing URI components using percent-encoding for characters that require it.

Accepts a parser that is used to determine whether a character is allowed to appear un-encoded in the URI component and the string to encode.

#printEncoded'

printEncoded' :: Parser String Char -> NonEmptyString -> NonEmptyString

A version of printEncoded that operates on non-empty strings.

#decodeURIComponent'

decodeURIComponent' :: NonEmptyString -> NonEmptyString

A version of decodeURIComponent that operates on non-empty strings.

Modules