GithubHelp home page GithubHelp logo

network-uri's Introduction

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.

network-uri's People

Contributors

ezrakilty avatar tibbe avatar christopherking42 avatar hvr avatar 23skidoo avatar jappeace avatar juhp avatar k-bx avatar k7k7 avatar rufflewind avatar robstewart57 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.