Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Synopsis
- uri :: QuasiQuoter
- staticURI :: String -> SpliceQ URI
- staticURI' :: String -> ExpQ
- relativeReference :: QuasiQuoter
- staticRelativeReference :: String -> SpliceQ URI
- staticRelativeReference' :: String -> ExpQ
Absolute URIs
uri :: QuasiQuoter #
staticURI
parses a specified string at compile time
and return an expression representing the URI when it's a valid URI.
Otherwise, it emits an error.
>>>
$$(staticURI "http://www.google.com/")
http://www.google.com/
>>>
$$(staticURI "http://www.google.com/##")
<interactive>... ... Invalid URI: http://www.google.com/## ...
staticURI'
parses a specified string at compile time.
The typed template haskell staticURI
is available only with GHC-7.8+.
Relative URIs
relativeReference :: QuasiQuoter #
relativeReference
is a quasi quoter for staticRelativeReference
.
>>>
[relativeReference|/foo?bar=baz#quux|]
/foo?bar=baz#quux
>>>
[relativeReference|http://www.google.com/|]
<interactive>... ... Invalid relative reference: http://www.google.com/ ...
staticRelativeReference
parses a specified string at compile time and
return an expression representing the URI when it's a valid relative
reference. Otherwise, it emits an error.
>>>
$$(staticRelativeReference "/foo?bar=baz#quux")
/foo?bar=baz#quux
>>>
$$(staticRelativeReference "http://www.google.com/")
<interactive>... ... Invalid relative reference: http://www.google.com/ ...
staticRelativeReference'
parses a specified string at compile time and
return an expression representing the URI when it's a valid relative
reference. Otherwise, it emits an error.
The typed template haskell staticRelativeReference
is available only with GHC-7.8+.