Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Warning: This module is not considered part of Burrito's public API. As such, it may change at any time. Use it with caution!.
Synopsis
Documentation
uriTemplate :: QuasiQuoter Source #
This can be used together with the QuasiQuotes
language extension to
parse a URI template at compile time. This is convenient because it allows
you to verify the validity of the template when you compile your file as
opposed to when you run it.
>>>
:set -XQuasiQuotes
>>>
import Burrito
>>>
let template = [uriTemplate|http://example/search{?query}|]
>>>
let values = [("query", stringValue "chorizo")]
>>>
expand values template
"http://example/search?query=chorizo"
Note that you cannot use escape sequences in this quasi-quoter. For example,
this is invalid: [uriTemplate|\xa0|]
. You can however use percent encoded
triples as normal. So this is valid: [uriTemplate|%c2%a0|]
.