happstack-server-7.1.7.1: Web related tools and services.

Safe Haskell | None

Happstack.Server.SURI

Description

A wrapper and type class so that functions like `seeOther` can take a URI which is represented by a `String`, `URI`, or other instance of `ToSURI`.

Synopsis

- path :: SURI -> String
- query :: SURI -> String
- scheme :: SURI -> String
- u_scheme :: (String -> String) -> SURI -> SURI
- u_path :: (String -> String) -> SURI -> SURI
- a_scheme :: String -> SURI -> SURI
- a_path :: String -> SURI -> SURI
- percentDecode :: String -> String
- unEscape :: String -> String
- unEscapeQS :: String -> String
- isAbs :: SURI -> Bool
- newtype SURI = SURI {
  - suri :: URI
  }
- render :: ToSURI a => a -> String
- parse :: String -> Maybe SURI
- class ToSURI x where
  - toSURI :: x -> SURI
- class FromPath x where
  - fromPath :: String -> x

# Documentation

path :: SURI -> String

Retrieves the path component from the URI

query :: SURI -> String

Retrieves the query component from the URI

scheme :: SURI -> String

Retrieves the scheme component from the URI

u_scheme :: (String -> String) -> SURI -> SURI

Modifies the scheme component of the URI using the provided function

u_path :: (String -> String) -> SURI -> SURI

Modifies the path component of the URI using the provided function

a_scheme :: String -> SURI -> SURI

Sets the scheme component of the URI

a_path :: String -> SURI -> SURI

Sets the path component of the URI

percentDecode :: String -> String

percent decode a String

e.g. `"hello%2Fworld"` -> `"hello/world"`

unEscape :: String -> String

unEscapeQS :: String -> String

isAbs :: SURI -> Bool

Returns true if the URI is absolute

newtype SURI

Constructors

SURI |
Fields suri :: URI

Instances

Eq SURI |
Data SURI |
Ord SURI |
Read SURI |
Show SURI |
Typeable SURI |
ToSURI SURI |

render :: ToSURI a => a -> String

Render should be used for prettyprinting URIs.

parse :: String -> Maybe SURI

Parses a URI from a String. Returns Nothing on failure.

class ToSURI x where

Convenience class for converting data types to URIs

Methods

toSURI :: x -> SURI

Instances

ToSURI String |
ToSURI Text |
ToSURI Text |
ToSURI URI |
ToSURI SURI |

class FromPath x where

Methods

fromPath :: String -> x