http-api-data: Converting to/from HTTP API data like URL pieces, headers and query parameters.

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

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

Please see README.md


[Skip to ReadMe]

Properties

Versions0.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, 0.3.7.1, 0.3.7.2, 0.3.8, 0.3.8.1, 0.3.9, 0.3.10, 0.4, 0.4
Change logCHANGELOG.md
Dependenciesattoparsec (>=0.13.2.2 && <0.14), attoparsec-iso8601 (>=1.0.1.0 && <1.1), base (>=4.7 && <4.13), base-compat (>=0.10.5 && <0.11), bytestring (>=0.10.4.0 && <0.11), containers (>=0.5.5.1 && <0.7), cookie (>=0.4.3 && <0.4.5), hashable (>=1.2.7.0 && <1.3), http-types (>=0.12.2 && <0.13), nats (>=1.1.2 && <1.2), semigroups (>=0.18.5 && <0.19), tagged (>=0.8.5 && <0.9), text (>=1.2.3.0 && <1.3), time (>=1.4.2 && <1.9), time-locale-compat (>=0.1.1.5 && <0.2), unordered-containers (>=0.2.9.0 && <0.3), uuid-types (>=1.0.3 && <1.1), void (>=0.7.2 && <0.8) [details]
LicenseBSD-3-Clause
AuthorNickolay Kudasov <nickolay.kudasov@gmail.com>
MaintainerNickolay Kudasov <nickolay.kudasov@gmail.com>
CategoryWeb
Home pagehttp://github.com/fizruk/http-api-data
Source repositoryhead: git clone https://github.com/fizruk/http-api-data
UploadedTue Nov 13 14:37:06 UTC 2018 by phadej

Modules

[Index]

Flags

NameDescriptionDefaultType
use-text-show

Use 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

Maintainers' corner

For package maintainers and hackage trustees


Readme for http-api-data-0.4

[back to package description]

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!