Safe Haskell | None |
---|
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.
#{...}
is the Shakespearean standard for variable interpolation, but
CoffeeScript already uses that sequence for string interpolation.
Therefore, it seems more future-proof to use %{...}
for interpolation
Integration with Roy is a bit rough right now. You can only perorm a shakespeare insertion inside a Roy string. This should work well for urls and strings. Otherwise you should stick your Haskell into Julius as a window variable, and then retrieve it in your Roy code.
Further reading:
- Shakespearean templates: http://www.yesodweb.com/book/templates
- Roy: http://http://roy.brianmckenna.org/
- 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
Read inline, quasiquoted Roy.
royFile :: FilePath -> Q ExpSource
Read in a Roy template file. This function reads the file once, at compile time.
royFileReload :: FilePath -> Q ExpSource
Read in a Roy template file. This impure function uses unsafePerformIO to re-read the file on every call, allowing for rapid iteration.