A Haskell library for the HTTP Link header as specified in RFC 5988 "Web Linking" https://hackage.haskell.org/package/http-link-header
 
Go to file
Val Packett cb87757e0e badges 2023-07-17 06:10:04 +00:00
benchmark Only have polymorphic functions and types 2020-08-28 16:53:51 -04:00
library/Network/HTTP Continue to use Unicode syntax 2020-08-29 17:10:24 -04: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 Remove stack.yaml comments and gitignore the cabal file 2020-08-26 18:23:33 -04:00
CHANGELOG.md Add CHANGELOG.md 2020-11-01 00:06:09 +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
UNLICENSE unlicense, code of conduct, stack in readme 2015-07-27 20:24:00 +03:00
package.yaml Project stuff 2022-10-18 02:43:01 +03:00
stack.yaml Project stuff 2022-10-18 02:43:01 +03:00

README.md

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.