Safe Haskell | None |
---|---|
Language | Haskell2010 |
A URI parsing library
- renderQuery :: Bool -> Query -> ByteString
- newtype Protocol = Protocol {}
- newtype FQDN = FQDN {}
- newtype Port = Port {}
- newtype PathParts = PathParts {
- _pathParts :: [Text]
- data URI
- uriPath :: Lens' URI Text
- parseURI :: Text -> Either String URI
- parseURI' :: String -> Either String URI
- renderURI :: URI -> ByteString
Documentation
Protocol is a basic protocol string, such as "http" or "ftp"
FQDN is the complete hostname of the server
Optional, but Port allows one to specify a non-default port for a URI
The path section of the URI, divided into one element per subdirectory
PathParts | |
|
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
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.