Safe Haskell | None |
---|---|
Language | Haskell2010 |
A Shakespearean module for Roy, introducing type-safe,
compile-time variable and url interpolation. It is exactly the same as
Text.Julius, except that the template is first compiled to Javascript with
the system tool roy
.
To use this module, roy
must be installed on your system.
If you interpolate variables,
the template is first wrapped with a function containing javascript variables representing shakespeare variables,
then compiled with roy
,
and then the value of the variables are applied to the function.
This means that in production the template can be compiled
once at compile time and there will be no dependency in your production
system on roy
.
Your code:
let b = 1 console.log(#{a} + b)
Final Result:
;(function(shakespeare_var_a){ var b = 1; console.log(shakespeare_var_a + b); })(#{a});
Further reading:
- Shakespearean templates: https://www.yesodweb.com/book/shakespearean-templates
- Roy: http://roy.brianmckenna.org/
Synopsis
- roy :: QuasiQuoter
- royFile :: FilePath -> Q Exp
- royFileReload :: FilePath -> Q Exp
Functions
Template-Reading Functions
These QuasiQuoter and Template Haskell methods return values of
type
. See the Yesod book for details.JavascriptUrl
url
roy :: QuasiQuoter Source #
Read inline, quasiquoted Roy.