Implements a data type for constructing and destructing x-www-urlencoded strings. See http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
- data URLEncoded
- empty :: URLEncoded
- importString :: MonadError e m => String -> m URLEncoded
- importList :: [(String, String)] -> URLEncoded
- (%=) :: String -> String -> URLEncoded
- (%=?) :: String -> Maybe String -> URLEncoded
- null :: URLEncoded -> Bool
- keys :: URLEncoded -> [String]
- lookup :: String -> URLEncoded -> [String]
- lookup1 :: MonadError e m => String -> URLEncoded -> m String
- pairs :: URLEncoded -> [(String, String)]
- addToURI :: URLEncoded -> URI -> URI
- export :: URLEncoded -> String
Representation of a URL-encoded string
data URLEncoded Source
A container for URLEncoded data
Generate
URLEncoded data with no pairs
importString :: MonadError e m => String -> m URLEncodedSource
Parse this string as x-www-urlencoded
importList :: [(String, String)] -> URLEncodedSource
Import this list of pairs as URLEncoded data
(%=) :: String -> String -> URLEncodedSource
Create singleton URLEncoded data containing the supplied key and value
:: String | key |
-> Maybe String | value |
-> URLEncoded |
If the second value is Nothing, return empty URLEncoded data. Otherwise return singleton URLEncoded data that contains the given key and value.
Query
null :: URLEncoded -> BoolSource
Is this URLEncoded data empty?
keys :: URLEncoded -> [String]Source
All of the keys from the URLEncoded value, in order, preserving duplicates
lookup :: String -> URLEncoded -> [String]Source
Return all values whose keys match the supplied key, in the order they appear in the query. Will return an empty list if no keys match.
lookup1 :: MonadError e m => String -> URLEncoded -> m StringSource
Return the first value for the given key, or throw an error if the key is not present in the URLEncoded data.
pairs :: URLEncoded -> [(String, String)]Source
Export
addToURI :: URLEncoded -> URI -> URISource
Add this URL-encoded data to the query part of a URI, after any existing query arguments.
export :: URLEncoded -> StringSource
Convert this URLEncoded object into an x-www-urlencoded String (The resulting string is 7-bit clean ASCII, containing only unreserved URI characters and %-encoded values)