network-uri: URI manipulation

[ bsd3, library, network ] [ Propose Tags ] [ Report a vulnerability ]

This package provides facilities for parsing and unparsing URIs, and creating and resolving relative URI references, closely following the URI spec, IETF RFC 3986.

Backward-compatibility

In network-2.6 the Network.URI module was split off from the network package into this package. If you're using the Network.URI module you can be backward compatible and automatically get it from the right package by using the network-uri-flag pseudo-package in your .cabal file's build-depends (along with dependencies for both network-uri and network):

 build-depends:
    network-uri-flag == 0.1.*

Or you can do the same manually by adding this boilerplate to your .cabal file:

flag network-uri
  description: Get Network.URI from the network-uri package
  default: True

library
  -- ...
  if flag(network-uri)
    build-depends: network-uri >= 2.6, network >= 2.6
  else
    build-depends: network-uri < 2.6, network < 2.6

That is, get the module from either network < 2.6 or from network-uri >= 2.6.


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 2.5.0.0, 2.6.0.0, 2.6.0.1, 2.6.0.2, 2.6.0.3, 2.6.1.0, 2.6.2.0, 2.6.3.0, 2.6.4.0, 2.6.4.1, 2.6.4.2, 2.7.0.0 (info)
Change log CHANGELOG.md
Dependencies base (>=3 && <5), deepseq (>=1.1 && <1.6), ghc-prim, parsec (>=3.1.12.0 && <3.2), template-haskell, th-compat (>=0.1.1 && <1.0) [details]
Tested with ghc ==9.8.1 || ==9.6.3 || ==9.4.7 || ==9.2.8 || ==9.0.2 || ==8.10.7 || ==8.8.4 || ==8.6.5 || ==8.4.4 || ==8.2.2 || ==8.0.2 || ==7.10.3 || ==7.8.4 || ==7.6.3 || ==7.4.2 || ==7.2.2 || ==7.0.4
License BSD-3-Clause
Author
Maintainer ezra@ezrakilty.net
Revised Revision 1 made by AndreasAbel at 2023-10-13T04:44:01Z
Category Network
Home page https://github.com/haskell/network-uri
Bug tracker https://github.com/haskell/network-uri/issues
Source repo head: git clone git://github.com/haskell/network-uri.git
Uploaded by EzraCooper at 2022-12-27T01:43:08Z
Distributions Arch:2.6.4.2, Debian:2.6.3.0, Fedora:2.6.4.2, FreeBSD:2.6.0.3, LTSHaskell:2.6.4.2, NixOS:2.6.4.2, Stackage:2.6.4.2, openSUSE:2.6.4.2
Reverse Dependencies 359 direct, 7770 indirect [details]
Downloads 183077 total (324 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-12-27 [all 1 reports]

Readme for network-uri-2.6.4.2

[back to package description]

The network-uri package

This package provides facilities for parsing and unparsing URIs, and creating and resolving relative URI references, closely following the URI spec, IETF RFC 3986 [1].

The main module in this package, Network.URI, was split off from the network package in the network-2.6 release.

Network.URI.Static

Network.URI.Static that allows you to declare static URIs in type-safe manner.

With the base module, when you declare a static URI, you need to either use Maybe URI or use URI and give up type safety.

safeButWrappedInMaybeURI :: Maybe URI
safeButWrappedInMaybeURI = parseURI "http://www.google.com/"

directButUnsafeURI :: URI
directButUnsafeURI = fromJust $ parseURI "http://www.google.com/"

This library allows you to write static URIs in type-safe manner by checking URIs at compile time using template haskell.

Now, you can write the following.

directAndSafeURI :: URI
directAndSafeURI = $$(staticURI "http://www.google.com")

You can even use a quasi quote if you'd like.

directAndSafeURI :: URI
directAndSafeURI = [uri|"http://www.google.com"|]

These two expressions emit an error at compile time if a specified URI is malformed.