A Haskell library for the HTTP Link header as specified in RFC 5988 "Web Linking" https://hackage.haskell.org/package/http-link-header
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Go to file
Val Packett b9df4e2dda Project stuff 8 months ago
benchmark Only have polymorphic functions and types 3 years ago
library/Network/HTTP Continue to use Unicode syntax 3 years ago
test-suite Only have polymorphic functions and types 3 years ago
.ghci change license to ISC, add ghci :bench 8 years ago
.gitignore Remove stack.yaml comments and gitignore the cabal file 3 years ago
CHANGELOG.md Add CHANGELOG.md 3 years ago
README.md Project stuff 8 months ago
Setup.hs release 1.0.2 7 years ago
UNLICENSE unlicense, code of conduct, stack in readme 8 years ago
package.yaml Project stuff 8 months ago
stack.yaml Project stuff 8 months ago

README.md

http-link-header Hackage 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"

License

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