uri-parse-0.1.0.1: A simple library for parsing and generating URIs

Safe HaskellNone
LanguageHaskell2010

LuminescentDreams.Data.URI

Description

A URI parsing library

Synopsis

Documentation

renderQuery #

Arguments

:: Bool

prepend question mark?

-> Query 
-> ByteString 

Convert Query to ByteString.

newtype Protocol Source #

Protocol is a basic protocol string, such as "http" or "ftp"

Constructors

Protocol 

Fields

newtype FQDN Source #

FQDN is the complete hostname of the server

Constructors

FQDN 

Fields

Instances

Eq FQDN Source # 

Methods

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

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

Show FQDN Source # 

Methods

showsPrec :: Int -> FQDN -> ShowS #

show :: FQDN -> String #

showList :: [FQDN] -> ShowS #

IsString FQDN Source # 

Methods

fromString :: String -> FQDN #

newtype Port Source #

Optional, but Port allows one to specify a non-default port for a URI

Constructors

Port 

Fields

Instances

Eq Port Source # 

Methods

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

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

Num Port Source # 

Methods

(+) :: Port -> Port -> Port #

(-) :: Port -> Port -> Port #

(*) :: Port -> Port -> Port #

negate :: Port -> Port #

abs :: Port -> Port #

signum :: Port -> Port #

fromInteger :: Integer -> Port #

Show Port Source # 

Methods

showsPrec :: Int -> Port -> ShowS #

show :: Port -> String #

showList :: [Port] -> ShowS #

newtype PathParts Source #

The path section of the URI, divided into one element per subdirectory

Constructors

PathParts 

Fields

data URI Source #

A straightforward URI data type

TODO: need to support usernames and passwords as part of the URI, such as postgres:/username:password@localhost:5432my_database

Instances

Eq URI Source # 

Methods

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

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

Show URI Source # 

Methods

showsPrec :: Int -> URI -> ShowS #

show :: URI -> String #

showList :: [URI] -> ShowS #

Default URI Source # 

Methods

def :: URI #

uriPath :: Lens' URI Text Source #

uriPath treats the path portion of the URI as a single string. This is more common and natural most of the time.

parseURI :: Text -> Either String URI Source #

Parse a URI from Text, returning either an error or a complete URI

TODO: Rebuild these functions for easy ByteString, Text, String parsing and rendering

parseURI' :: String -> Either String URI Source #

Parse a URI from a String, returning either an error or a complete URI

renderURI :: URI -> ByteString Source #

Render a URI to a ByteString - I chose bytestrings because they are so frequently required in HTTP libraries.