BSD-3-Clause licensed
Maintained by [email protected]
This version can be pinned in stack with:network-uri-2.6.3.0@sha256:d2d9ff3a80d9b2d1ff317a354bc0c56cc109c69a4c2449e5fc712d3ddce83ede,2902

Module documentation for 2.6.3.0

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.

Changes

network-uri-2.6.3.0 (2020-02-18)

  • Add official support for SafeHaskell NOTE: This is the first version whose SafeHaskell properties have become an intentional part of the API contract; previous versions were merely accidentally safe-inferred (or not depending on various factors; in other words, this was a fragile property).
  • Derive Lift instances using DeriveLift extension, when available.

network-uri-2.6.2.0 (2020-01-30)

  • Mark the modules as Safe for SafeHaskell.

network-uri-2.6.2.0 (2020-01-30)

  • Merge network-uri-static (Network.URI.Static) into this package, which offers a way to parse URI strings at compile time.
  • Add Lenses for the URI types
  • Add Generic instances for the URI type
  • Add Lift instances for the URI type
  • Optimize isReserved and related character-class functions.
  • Start to add some benchmarks for performance analysis
  • Fix a bug: Correctly parse IPv6 addresses in URIs.
  • Add rectify which normalizes a URI if it is missing certain separator characters required by the module. Some users found adding those characters inconvenient when building a URI from parts.
  • Add nullURIAuth and uriAuthToString, paralleling nullURI and uriToString.

network-uri-2.6.0.3

  • Fix a bug with IPv4 address parsing.

network-uri-2.6.0.2

  • Implement Generic and NFData.

network-uri-2.6.0.0

  • Initial release: Module split off from network.