The http-api-data package

[Tags:bsd3, library, test]

Please see README.md


[Skip to Readme]

Properties

Versions 0.1.0, 0.1.1, 0.1.1.1, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.3, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.3.6, 0.3.7
Change log CHANGELOG.md
Dependencies attoparsec (>=0.13.0.1 && <0.14), attoparsec-iso8601 (>=1.0.0.0 && <1.1), base (>=4.7 && <4.10), bytestring, containers, hashable, http-types, text (>=0.5), time, time-locale-compat (>=0.1.1.0 && <0.2), unordered-containers, uri-bytestring, uuid-types (>=1.0.2 && <1.1) [details]
License BSD3
Author Nickolay Kudasov <nickolay.kudasov@gmail.com>
Maintainer Nickolay Kudasov <nickolay.kudasov@gmail.com>
Category Web
Home page http://github.com/fizruk/http-api-data
Source repository head: git clone https://github.com/fizruk/http-api-data
Uploaded Fri Apr 21 07:11:51 UTC 2017 by NickolayKudasov
Distributions Arch:0.3.6, Debian:0.2.1, LTSHaskell:0.3.7, NixOS:0.3.7, Stackage:0.3.7, Tumbleweed:0.3.6
Downloads 2290 total (1138 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2017-04-21 [all 1 reports]

Modules

[Index]

Flags

NameDescriptionDefaultType
use-text-showUse text-show library for efficient ToHttpApiData implementations.DisabledManual

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for http-api-data

Readme for http-api-data-0.3.7

http-api-data

Build Status Hackage package Stackage LTS Stackage Nightly

This package defines typeclasses used for converting Haskell data types to and from HTTP API data.

Examples

Booleans:

>>> toUrlPiece True
"true"
>>> parseUrlPiece "false" :: Either Text Bool
Right False
>>> parseUrlPieces ["true", "false", "undefined"] :: Either Text [Bool]
Left "could not parse: `undefined'"

Numbers:

>>> toQueryParam 45.2
"45.2"
>>> parseQueryParam "452" :: Either Text Int
Right 452
>>> toQueryParams [1..5]
["1","2","3","4","5"]
>>> parseQueryParams ["127", "255"] :: Either Text [Int8]
Left "out of bounds: `255' (should be between -128 and 127)"

Strings:

>>> toHeader "hello"
"hello"
>>> parseHeader "world" :: Either Text String
Right "world"

Calendar day:

>>> toQueryParam (fromGregorian 2015 10 03)
"2015-10-03"
>>> toGregorian <$> parseQueryParam "2016-12-01"
Right (2016,12,1)

Contributing

Contributions and bug reports are welcome!