简体   繁体   中英

How do I pass simple Haskell variables to a Heist template?

First off, I'm very new to Snap and Heist :)

In all templating engines that I have used, there is always a way to pass a variable from the render function to the template. The template can then display the variable in its place. Now, I do understand that Heist is particularly strict, but I'm not even trying to do a loop or an if/else here, just display a random number. I imagine this is a pretty basic thing, but I haven't found anything in the docs that shows how this can be done without using splices.

So in short, is it possible to have a Snap handler that generates a number, then passes it to a Heist template to render, without using splices? If yes, please give me some example code, if no, please show me the simplest way it can be done.

Splices are the way that you pass Haskell information to a template. That's the way you have to do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM