uri-0.1.6.4: Library for working with URIs

Safe Haskell | Safe
Language | Haskell98

Text.URI

Synopsis

- data URI = URI {
  - uriScheme :: Maybe String
  - uriUserInfo :: Maybe String
  - uriRegName :: Maybe String
  - uriPort :: Maybe Integer
  - uriPath :: String
  - uriQuery :: Maybe String
  - uriFragment :: Maybe String
  }
- dereferencePath :: [String] -> [String]
- dereferencePathString :: String -> String
- escapeString :: (Char -> Bool) -> String -> String
- isReference :: URI -> Bool
- isRelative :: URI -> Bool
- nullURI :: URI
- okInFragment :: Char -> Bool
- okInPath :: Char -> Bool
- okInPathSegment :: Char -> Bool
- okInQuery :: Char -> Bool
- okInQueryItem :: Char -> Bool
- okInUserinfo :: Char -> Bool
- mergePaths :: [String] -> [String] -> [String]
- mergePathStrings :: String -> String -> String
- mergeURIs :: URI -> URI -> URI
- mergeURIStrings :: String -> String -> String
- pairsToQuery :: [(String, String)] -> String
- parseURI :: String -> Maybe URI
- pathToSegments :: String -> [String]
- segmentsToPath :: [String] -> String
- queryToPairs :: String -> [(String, String)]
- unescapeString :: String -> String
- uriPathSegments :: URI -> [String]
- uriQueryItems :: URI -> [(String, String)]

# Documentation

data URI Source #

Represents a general universal resource identifier using its component parts.

For example, for the URI

      foo://anonymous@www.haskell.org:42/ghc?query#frag

the components are:

Constructors

URI |

Fields

- uriScheme :: Maybe String

      foo

- uriUserInfo :: Maybe String

      anonymous

- uriRegName :: Maybe String

      www.haskell.org

- uriPort :: Maybe Integer

      42

- uriPath :: String

      /ghc

- uriQuery :: Maybe String

      query

- uriFragment :: Maybe String

      frag

#### Instances

Instances details

Eq URI Source # |
Instance details Defined in Text.URI Methods (==) :: URI -> URI -> Bool (/=) :: URI -> URI -> Bool
Data URI Source # |

Instance details

Defined in Text.URI

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> URI -> c URI

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c URI

toConstr :: URI -> Constr

dataTypeOf :: URI -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c URI)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c URI)

gmapT :: (forall b. Data b => b -> b) -> URI -> URI

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> URI -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> URI -> r

gmapQ :: (forall d. Data d => d -> u) -> URI -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> URI -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> URI -> m URI

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> URI -> m URI

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> URI -> m URI

Ord URI Source # |
Instance details Defined in Text.URI Methods compare :: URI -> URI -> Ordering (<) :: URI -> URI -> Bool (<=) :: URI -> URI -> Bool (>) :: URI -> URI -> Bool (>=) :: URI -> URI -> Bool max :: URI -> URI -> URI min :: URI -> URI -> URI
Show URI Source # |
Instance details Defined in Text.URI Methods showsPrec :: Int -> URI -> ShowS show :: URI -> String showList :: [URI] -> ShowS

dereferencePath :: [String] -> [String] Source #

Removes ".." and "." from path

dereferencePathString :: String -> String Source #

dereferencePath for strings

escapeString :: (Char -> Bool) -> String -> String Source #

Escapes string, using predicate to determine whether character is allowed

isReference :: URI -> Bool Source #

Checks if uri is a reference

isRelative :: URI -> Bool Source #

Checks if uri is relative

nullURI :: URI Source #

Blank URI

okInFragment :: Char -> Bool Source #

Checks if character is OK in fragment

okInPath :: Char -> Bool Source #

Checks if character is OK in path

okInPathSegment :: Char -> Bool Source #

Checks if character is ok in path segment

okInQuery :: Char -> Bool Source #

Checks if character is OK in query

okInQueryItem :: Char -> Bool Source #

Checks if character is OK in urlencoded query item

okInUserinfo :: Char -> Bool Source #

Checks if character is OK in userinfo

mergePaths :: [String] -> [String] -> [String] Source #

Merges two paths

mergePathStrings :: String -> String -> String Source #

mergePaths for strings

mergeURIs Source #

Arguments

:: URI | Base URI
-> URI | Reference URI
-> URI | Resulting URI

Merges two URIs

mergeURIStrings :: String -> String -> String Source #

mergeURIs for strings

pairsToQuery :: [(String, String)] -> String Source #

Composes www-urlencoded query from key-value pairs

parseURI :: String -> Maybe URI Source #

Parses URI

pathToSegments :: String -> [String] Source #

Splits path to segments

segmentsToPath :: [String] -> String Source #

Joins path segments, with escaping

queryToPairs :: String -> [(String, String)] Source #

Parses www-urlencoded string to key-value pairs

unescapeString :: String -> String Source #

Unescapes percent-sequences

uriPathSegments :: URI -> [String] Source #

Convenience function for extracting path segments

uriQueryItems :: URI -> [(String, String)] Source #

Convenience function for extracting www-urlencoded data