Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Network/URI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ module Network.URI
, normalizeEscape
, normalizePathSegments

-- * Raw Parsec parsers
, uriParser, relativeReferenceParser

-- * Deprecated functions
, parseabsoluteURI
, escapeString
Expand Down Expand Up @@ -469,6 +472,11 @@ unreservedChar = (:[]) <$> satisfy isUnreserved
-- / path-rootless
-- / path-empty

-- | A Parsec parser for any complete URI, or what is often called an "absolute" URI,
-- that is one that begins with a scheme like "http://".
uriParser :: URIParser URI
uriParser = uri -- Note the name is for module export

uri :: URIParser URI
uri =
do { us <- try uscheme
Expand Down Expand Up @@ -819,6 +827,12 @@ uriReference = uri <|> relativeRef
-- / path-noscheme
-- / path-empty

-- | A Parsec parser for a "relative URI reference", that is a string that can
-- be interpreted as a URI relative to some absolute base URI. A common
-- example would be a simple path, such as "/poets/persian/rumi".
relativeReferenceParser :: URIParser URI
relativeReferenceParser = relativeRef -- Note the name is for module export

relativeRef :: URIParser URI
relativeRef =
do { notMatching uscheme
Expand Down
9 changes: 5 additions & 4 deletions network-uri.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ test-suite uri
base < 5,
HUnit,
network-uri,
test-framework,
test-framework-hunit,
test-framework-quickcheck2,
tasty,
tasty-hunit,
tasty-quickcheck,
QuickCheck

ghc-options: -Wall -fwarn-tabs
Expand All @@ -104,7 +104,8 @@ benchmark uri-bench
HUnit,
network-uri,
criterion,
deepseq
deepseq,
random

ghc-options: -Wall -fwarn-tabs
default-language: Haskell98
Expand Down
8 changes: 4 additions & 4 deletions tests/uri001.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ import Data.Char (ord, chr)
import Data.Maybe (fromJust)
import Data.List (intercalate)
import System.IO (openFile, IOMode(WriteMode), hClose)
import qualified Test.Framework as TF
import qualified Test.Framework.Providers.HUnit as TF
import qualified Test.Framework.Providers.QuickCheck2 as TF
import qualified Test.Tasty as TF
import qualified Test.Tasty.QuickCheck as TF
import qualified Test.Tasty.HUnit as TF
import Test.QuickCheck ((==>), Property)

-- Test supplied string for valid URI reference syntax
Expand Down Expand Up @@ -1353,7 +1353,7 @@ testRectify = TF.testGroup "testRectify"
]

-- Full test suite
allTests =
allTests = TF.testGroup "all"
[ testURIRefSuite
, testComponentSuite
, testRelativeSuite
Expand Down