network-uri-2.6.4.2: URI manipulation

Safe Haskell | Safe
Language | Haskell98

Network.URI.Static

Contents

- Absolute URIs
- Relative URIs

Synopsis

- uri :: QuasiQuoter
- staticURI :: String -> SpliceQ URI
- staticURI' :: String -> ExpQ
- relativeReference :: QuasiQuoter
- staticRelativeReference :: String -> SpliceQ URI
- staticRelativeReference' :: String -> ExpQ

# Absolute URIs

uri :: QuasiQuoter Source #

`uri` is a quasi quoter for `staticURI`.

    >>> [uri|http://www.google.com/|]
    http://www.google.com/

    >>> [uri|http://www.google.com/##|]

    <interactive>...
    ... Invalid URI: http://www.google.com/##
    ...

staticURI Source #

Arguments

:: String | String representation of a URI
-> SpliceQ URI | URI

`staticURI` parses a specified string at compile time and return an expression representing the URI when it's a valid URI. Otherwise, it emits an error.

    >>> $$(staticURI "http://www.google.com/")
    http://www.google.com/

    >>> $$(staticURI "http://www.google.com/##")

    <interactive>...
    ... Invalid URI: http://www.google.com/##
    ...

staticURI' Source #

Arguments

:: String | String representation of a URI
-> ExpQ | URI

`staticURI'` parses a specified string at compile time.

The typed template haskell `staticURI` is available only with GHC-7.8+.

# Relative URIs

relativeReference :: QuasiQuoter Source #

`relativeReference` is a quasi quoter for `staticRelativeReference`.

    >>> [relativeReference|/foo?bar=baz#quux|]
    /foo?bar=baz#quux

    >>> [relativeReference|http://www.google.com/|]

    <interactive>...
    ... Invalid relative reference: http://www.google.com/
    ...

staticRelativeReference Source #

Arguments

:: String | String representation of a reference
-> SpliceQ URI | Refererence

`staticRelativeReference` parses a specified string at compile time and return an expression representing the URI when it's a valid relative reference. Otherwise, it emits an error.

    >>> $$(staticRelativeReference "/foo?bar=baz#quux")
    /foo?bar=baz#quux

    >>> $$(staticRelativeReference "http://www.google.com/")

    <interactive>...
    ... Invalid relative reference: http://www.google.com/
    ...

staticRelativeReference' Source #

Arguments

:: String | String representation of a reference
-> ExpQ | Refererence

`staticRelativeReference'` parses a specified string at compile time and return an expression representing the URI when it's a valid relative reference. Otherwise, it emits an error.

The typed template haskell `staticRelativeReference` is available only with GHC-7.8+.