Url

From HaskellWiki
Revision as of 13:05, 11 December 2008 by AlmonPasra (talk | contribs) (http://lakinkea.strefa.pl/comment-1622.htm)
Jump to navigation Jump to search

[andrew school of medical transcription|http://lakinkea.strefa.pl/comment-1622.htm] [andrew school of medical transcription] school of medical transcription ((http://lakinkea.strefa.pl/comment-1622.htm andrew school of medical transcription)) [| andrew school of medical transcription] "andrew school of medical transcription":http://lakinkea.strefa.pl/comment-1622.htm [fort myers beach new homes|http://wejolly.strefa.pl/fort-myers-beach-20081128.html] [fort myers beach new homes] myers beach new homes ((http://wejolly.strefa.pl/fort-myers-beach-20081128.html fort myers beach new homes)) [| fort myers beach new homes] "fort myers beach new homes":http://wejolly.strefa.pl/fort-myers-beach-20081128.html [music pitbull shake video|http://wejolly.strefa.pl/music-pitbull-20081123.html] [music pitbull shake video] pitbull shake video ((http://wejolly.strefa.pl/music-pitbull-20081123.html music pitbull shake video)) [| music pitbull shake video] "music pitbull shake video":http://wejolly.strefa.pl/music-pitbull-20081123.html [handheld pos restaurant|http://miminerv.strefa.pl/20081122-restaurant-pos.html] [handheld pos restaurant] pos restaurant ((http://miminerv.strefa.pl/20081122-restaurant-pos.html handheld pos restaurant)) [| handheld pos restaurant] "handheld pos restaurant":http://miminerv.strefa.pl/20081122-restaurant-pos.html [pink floyd live at pompeii torrent|http://kamada.strefa.pl/page1518.html] [pink floyd live at pompeii torrent] floyd live at pompeii torrent ((http://kamada.strefa.pl/page1518.html pink floyd live at pompeii torrent)) [| pink floyd live at pompeii torrent] "pink floyd live at pompeii torrent":http://kamada.strefa.pl/page1518.html The URL library provides a module Network.URL that makes it easy to work with HTTP URLs.

Links:

Please feel free to update this page with extra documentation and examples of how to use the package.

The following example shows how to parse a URL and then add some parameters to it:

import Network.URL

test x = case importURL x of
           Just u  -> print $ exportURL $ add_param u ("Hello","World?")
           Nothing -> print "invalid URL"

Here is some sample output:

*Main> test "http://www.haskell.org"
"http://www.haskell.org/?Hello=World%3f"

Note that the question mark in the parameters was escaped automatically.