http-link-header

A parser and writer for the HTTP Link header as specified in RFC 5988 "Web Linking".

https://github.com/myfreeweb/http-link-header

Version on this page:1.0.3
LTS Haskell 22.13:1.2.1@rev:3
Stackage Nightly 2024-03-14:1.2.1@rev:3
Latest on Hackage:1.2.1@rev:3

See all snapshots http-link-header appears in

LicenseRef-PublicDomain licensed by Greg V
Maintained by [email protected]
This version can be pinned in stack with:http-link-header-1.0.3@sha256:7bb1f40ffc4c1e869c04a7443ac53fd2f6dba447bfc48f07084b87fea0163445,1941

Module documentation for 1.0.3

http-link-header Hackage Build Status Coverage Status unlicense

A Haskell library than implements a parser and a writer for the HTTP Link header as specified in RFC 5988 “Web Linking”.

Usage

import Network.HTTP.Link
import Network.URI
import Data.Maybe

----- Writing
writeLinkHeader [ Link (fromJust $ parseURI "https://example.com/hello%20world") [(Rel, "next"), (Title, "hello world")]
                , Link (fromJust $ parseURI "https://yolo.tld") [(Rel, "license")] ]
-- "<https://example.com/hello%20world>; rel=\"next\"; title=\"hello world\", <https://yolo.tld>; rel=\"license\""

----- Parsing
parseLinkHeader "<https://example.com/2>; rel=\"next\", <https://example.com/0>; rel=prev"
-- Just [ Link https://example.com/2 [(Rel, "next")]
--      , Link https://example.com/0 [(Rel, "prev")] ]

Development

Use stack to build.
Use ghci to run tests quickly with :test (see the .ghci file).

$ stack build

$ stack test && rm tests.tix

$ stack bench

$ stack ghci --ghc-options="-fno-hpc"

Contributing

Please feel free to submit pull requests! Bugfixes and simple non-breaking improvements will be accepted without any questions :-)

By participating in this project you agree to follow the Contributor Code of Conduct.

The list of contributors is available on GitHub.

License

This is free and unencumbered software released into the public domain.
For more information, please refer to the UNLICENSE file or unlicense.org.