http-types-0.9.1: Generic HTTP types for Haskell (for both client and server code).

Safe Haskell | None
Language | Haskell98

Network.HTTP.Types.QueryLike

Synopsis

- class QueryLike a where
- class QueryKeyLike a where
- class QueryValueLike a where

# Documentation

class QueryLike a where #

Types which can, and commonly are, converted to `Query` are in this class.

You can use lists of simple key value pairs, with `ByteString` (strict, or lazy: `ByteString`), `Text`, or `String` as the key/value types. You can also have the value type lifted into a Maybe to support keys without values; and finally it is possible to put each pair into a Maybe for key-value pairs that aren't always present.

Minimal complete definition

toQuery

Methods

toQuery :: a -> Query #

Convert to `Query`.

Instances

(QueryKeyLike k, QueryValueLike v) => QueryLike [Maybe (k, v)] # |
Methods toQuery :: [Maybe (k, v)] -> Query #
(QueryKeyLike k, QueryValueLike v) => QueryLike [(k, v)] # |
Methods toQuery :: [(k, v)] -> Query #

class QueryKeyLike a where #

Types which, in a Query-like key-value list, are used in the Key position.

Minimal complete definition

toQueryKey

Methods

toQueryKey :: a -> ByteString #

Instances

QueryKeyLike ByteString # |
Methods toQueryKey :: ByteString -> ByteString #
QueryKeyLike ByteString # |
Methods toQueryKey :: ByteString -> ByteString #
QueryKeyLike Text # |
Methods toQueryKey :: Text -> ByteString #
QueryKeyLike [Char] # |
Methods toQueryKey :: [Char] -> ByteString #

class QueryValueLike a where #

Types which, in a Query-like key-value list, are used in the Value position.

Minimal complete definition

toQueryValue

Methods

toQueryValue :: a -> Maybe ByteString #

Instances

QueryValueLike ByteString # |
Methods toQueryValue :: ByteString -> Maybe ByteString #
QueryValueLike ByteString # |
Methods toQueryValue :: ByteString -> Maybe ByteString #
QueryValueLike Text # |
Methods toQueryValue :: Text -> Maybe ByteString #
QueryValueLike [Char] # |
Methods toQueryValue :: [Char] -> Maybe ByteString #
QueryValueLike a => QueryValueLike (Maybe a) # |
Methods toQueryValue :: Maybe a -> Maybe ByteString #