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,
43import Web.HttpApiData.Internal
47-- >>> :set -XOverloadedStrings
48-- >>> import Control.Applicative
49-- >>> import Data.Time
51-- >>> import Data.Text (Text)
52-- >>> import Data.Time (Day)
53-- >>> import Data.Version
61-- >>> parseUrlPiece "false" :: Either Text Bool
63-- >>> parseUrlPieces ["true", "false", "undefined"] :: Either Text [Bool]
64-- Left "could not parse: `undefined'"
68-- >>> toQueryParam 45.2
70-- >>> parseQueryParam "452" :: Either Text Int
72-- >>> toQueryParams [1..5]
73-- ["1","2","3","4","5"]
74-- >>> parseQueryParams ["127", "255"] :: Either Text [Int8]
75-- Left "out of bounds: `255' (should be between -128 and 127)"
79-- >>> toHeader "hello"
81-- >>> parseHeader "world" :: Either Text String
86-- >>> toQueryParam (fromGregorian 2015 10 03)
88-- >>> 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