BSD-3-Clause licensed
Maintained by [email protected]
This version can be pinned in stack with:network-uri-,2917

Module documentation for

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 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 ""

directButUnsafeURI :: URI
directButUnsafeURI = fromJust $ parseURI ""

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 "")

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

directAndSafeURI :: URI
directAndSafeURI = [uri|""|]

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


network-uri- (2020-01-30)

  • Merge network-uri-static (Network.URI.Static) into this package
  • Add Lenses for the URI types
  • Optimize isReserved and related character-class functions
  • Add Generic instances for the URI type
  • Add Lift instances for the URI type

network-uri- (2019-??-??)

  • Start to add some benchmarks for performance analysis
  • Correctly parse IPv6 addresses in URIs
  • Add rectify which normalizes a URI if it is missing certain separator characters required by the module, which some users find inconvenient.