-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | DEPRECATED A simple, liberal URL parser. -- -- DEPRECATED A simple, liberal URL parser. @package URLb @version 0.0.1 -- | URL parser, following RFC 3986 -- (http://tools.ietf.org/html/rfc3986). module Network.URLb -- | URL "...refers to the subset of URIs that, in addition to identifying -- a resource, provide a means of locating the resource by describing its -- primary access mechanism". -- -- A breakdown of URLs, per the diagram from RFC 3986: -- --
--     foo://example.com:8042/over/there?name=ferret#nose
--     \_/   \______________/\_________/ \_________/ \__/
--      |           |            |            |        |
--   scheme     authority       path        query   fragment
--      |   _____________________|__
--     / \ /                        \
--     urn:example:animal:ferret:nose
--   
-- -- For the most part, URL parts are made of strings with percent encoding -- required of certain characters. The scheme is especially limited in -- the allowable data: -- --
--   scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
--   
-- -- Note well that no percent encoding is allowed. -- -- The authority section, nominally denoting userinfo@host:port, -- is in fact quite flexible, allowing percent encoding for the hostname -- and userinfo section; only the port has a byte range restriction, to -- digits. -- -- Since this datatype represents the data in a URL and not its -- particular encoded form, we use ByteString liberally. data URL URL :: Scheme -> Maybe Authority -> ByteString -> ByteString -> ByteString -> URL scheme :: URL -> Scheme authority :: URL -> Maybe Authority path :: URL -> ByteString query :: URL -> ByteString fragment :: URL -> ByteString data Authority Authority :: ByteString -> ByteString -> Maybe Word16 -> Authority userinfo :: Authority -> ByteString host :: Authority -> ByteString port :: Authority -> Maybe Word16 newtype Scheme Scheme :: ByteString -> Scheme -- | Class for encoding items from this module as URLs. class Encode t encode :: Encode t => t -> ByteString -- | Class for parsing URL-related datatypes. class Parse t parser :: Parse t => Parser t -- |
--   *( unreserved / pct-encoded / sub-delims / ":" )
--   
userinfoOctet :: Word8 -> Bool userinfoP :: Parser ByteString -- |
--   *( unreserved / pct-encoded / sub-delims )
--   
regNameOctet :: Word8 -> Bool regNameP :: Parser ByteString percent :: Parser Word8 -- | Paths are quite sophisticated, with 5 productions to handle the -- different URI contexts in which they appear. However, for the purpose -- of URL parsing, we can assume that paths are always separated from the -- authority (even the empty authority) with a / and thus can -- work with a relatively simple subset of the productions in the RFC. -- --
--   path-rootless = segment-nz *( "/" segment )
--   
--   ...
--   
--   segment-nz    = 1*pchar
--   
--   ...
--   
--   pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
--   
-- -- Although literal slash runs are not permitted by the RFC, equivalent -- content can be encoded with percent encoding. pathRootlessP :: Parser ByteString -- | To parse the authority and path: -- -- segmentOctet :: Word8 -> Bool authorityPath :: Parser (Maybe Authority, ByteString) queryFragmentOctet :: Word8 -> Bool queryFragmentP :: Parser ByteString usingOnly :: Int -> Parser t -> Parser t -- | Parse a bytestream, accepting either literal bytes matching the -- predicate or any percent encoded characters. withPercents :: (Word8 -> Bool) -> Parser ByteString -- | Transform any octet to its percent encoded form. percentEncode :: Word8 -> ByteString -- | Percent encode a ByteString, ignoring octets that match the -- predicate. selectiveEncode :: (Word8 -> Bool) -> ByteString -> ByteString concatNonEmpty :: ByteString -> ByteString -> ByteString -- | Slash runs are not allowed in encoded paths. Here, this is interpreted -- to mean that the first slash in path data, which would come after the -- slash separating the path and the scheme or authority, should be -- escaped. pathEncode :: ByteString -> ByteString fromString' :: Parse a => String -> Either String a fromRight :: Either [Char] t -> t instance Eq Authority instance Ord Authority instance Show Authority instance Eq Scheme instance Ord Scheme instance Show Scheme instance Eq URL instance Ord URL instance Show URL instance Parse Scheme instance Encode Scheme instance IsString Scheme instance Encode Authority instance Parse Authority instance IsString Authority instance Encode URL instance Parse URL instance IsString URL