About

Metadata

  • Last updated , by AndreasAbel
  • License BSD-3-Clause
  • Categories Network Development
  • Maintained by: ezra@ezrakilty.net

  • Lottery factor: 0

Links

Installation

Tested Compilers

  1. 9.8.1
  2. 9.6.3
  3. 9.4.7
  4. 9.2.8
  5. 9.0.2
  6. 8.10.7
  7. 8.8.4
  8. 8.6.5
  9. 8.4.4
  10. 8.2.2
  11. 8.0.2
  12. 7.10.3

Readme

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.