url-bytes-0.1.0.0: Memory efficient url type and parser.

Safe HaskellNone
LanguageHaskell2010

Url

Contents

Description

Note: this library parses, but does not validate urls

Synopsis

Types

data Url Source #

Url type represented by its serialization, and slices of that serialization.

Syntax in pseudo-BNF:

url = scheme ":" [ hierarchical | non-hierarchical ] [ "?" query ]? [ "#" fragment ]?
non-hierarchical = non-hierarchical-path
non-hierarchical-path = * Does not start with "" */
hierarchical = authority? hierarchical-path
authority = "//" userinfo? host [ ":" port ]?
userinfo = username [ ":" password ]? "@"
hierarchical-path = [ "/" path-segment ]+
Instances
Eq Url Source # 
Instance details

Defined in Url.Unsafe

Methods

(==) :: Url -> Url -> Bool #

(/=) :: Url -> Url -> Bool #

Ord Url Source # 
Instance details

Defined in Url.Unsafe

Methods

compare :: Url -> Url -> Ordering #

(<) :: Url -> Url -> Bool #

(<=) :: Url -> Url -> Bool #

(>) :: Url -> Url -> Bool #

(>=) :: Url -> Url -> Bool #

max :: Url -> Url -> Url #

min :: Url -> Url -> Url #

Show Url Source # 
Instance details

Defined in Url.Unsafe

Methods

showsPrec :: Int -> Url -> ShowS #

show :: Url -> String #

showList :: [Url] -> ShowS #

Parsing

decodeUrl :: Bytes -> Either ParseError Url Source #

Decode a hierarchical URL

Slicing

getScheme :: Url -> Maybe Bytes Source #

Slice into the Url and retrieve the scheme, if it's present

getUsername :: Url -> Maybe Bytes Source #

Slice into the Url and retrieve the username, if it's present

getHost :: Url -> Maybe Bytes Source #

Slice into the Url and retrieve the host, if it's present

getPath :: Url -> Maybe Bytes Source #

Slice into the Url and retrieve the path starting with '/', if it's present

getQuery :: Url -> Maybe Bytes Source #

Slice into the Url and retrieve the query string starting with '?', if it's present

getFragment :: Url -> Maybe Bytes Source #

Slice into the Url and retrieve the fragment starting with '#', if it's present

getExtension :: Url -> Maybe Bytes Source #

This function is intentionally imprecise. E.g. getExtension "google.com/facebook.com" == Just ".com"

constructUrl Source #

Arguments

:: Maybe String

scheme

-> String

host

-> Maybe Word16

port

-> String

path

-> [(String, String)] 
-> Maybe String

framgent

-> Q (TExp Url)