2-- Convert Haskell values to and from HTTP API data
3-- such as URL pieces, headers and query parameters.
4module Web.HttpApiData (
12 -- * @'Maybe'@ parsers
18 parseUrlPieceWithPrefix,
19 parseHeaderWithPrefix,
20 parseQueryParamWithPrefix,
22 -- * Multiple URL pieces
26 -- * Multiple query params
30 -- * Parsers for @'Bounded'@ @'Enum'@s
32 parseBoundedQueryParam,
46import Web.Internal.HttpApiData
50-- >>> :set -XOverloadedStrings
51-- >>> import Control.Applicative
52-- >>> import Data.Time.Compat
54-- >>> import Data.Text (Text)
55-- >>> import Data.Version
63-- >>> parseUrlPiece "false" :: Either Text Bool
65-- >>> parseUrlPieces ["true", "false", "undefined"] :: Either Text [Bool]
66-- Left "could not parse: `undefined'"
70-- >>> toQueryParam 45.2
72-- >>> parseQueryParam "452" :: Either Text Int
74-- >>> toQueryParams [1..5] :: [Text]
75-- ["1","2","3","4","5"]
76-- >>> parseQueryParams ["127", "255"] :: Either Text [Int8]
77-- Left "out of bounds: `255' (should be between -128 and 127)"
81-- >>> toHeader "hello"
83-- >>> parseHeader "world" :: Either Text String
88-- >>> toQueryParam (fromGregorian 2015 10 03)
90-- >>> toGregorian <$> parseQueryParam "2016-12-01"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list