A Haskell library for the HTTP Link header as specified in RFC 5988 "Web Linking" https://hackage.haskell.org/package/http-link-header
Find a file
2025-04-15 05:11:30 -03:00
benchmark Only have polymorphic functions and types 2020-08-28 16:53:51 -04:00
library/Network/HTTP *Actually* fix #1 2025-04-15 05:02:43 -03:00
test-suite Only have polymorphic functions and types 2020-08-28 16:53:51 -04:00
.ghci change license to ISC, add ghci :bench 2015-02-20 23:33:22 +03:00
.gitignore ignore dist-newstyle 2025-03-28 02:04:46 -03:00
CHANGELOG.md Add CHANGELOG.md 2020-11-01 00:06:09 +03:00
package.yaml release 1.2.3 2025-04-15 05:11:30 -03:00
README.md badges 2023-07-17 06:10:04 +00:00
Setup.hs release 1.0.2 2016-08-29 19:43:57 +00:00
stack.yaml Update stack resolver to the new nightly that uses ghc 9.10 2025-04-15 05:10:56 -03:00
UNLICENSE unlicense, code of conduct, stack in readme 2015-07-27 20:24:00 +03:00

Hackage unlicense Support me on Patreon

http-link-header

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"

License

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