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
54-- >>> import Data.Text (Text)
55-- >>> import Data.Time (Day)
56-- >>> import Data.Version
64-- >>> parseUrlPiece "false" :: Either Text Bool
66-- >>> parseUrlPieces ["true", "false", "undefined"] :: Either Text [Bool]
67-- Left "could not parse: `undefined'"
71-- >>> toQueryParam 45.2
73-- >>> parseQueryParam "452" :: Either Text Int
75-- >>> toQueryParams [1..5] :: [Text]
76-- ["1","2","3","4","5"]
77-- >>> parseQueryParams ["127", "255"] :: Either Text [Int8]
78-- Left "out of bounds: `255' (should be between -128 and 127)"
82-- >>> toHeader "hello"
84-- >>> parseHeader "world" :: Either Text String
89-- >>> toQueryParam (fromGregorian 2015 10 03)
91-- >>> 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