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

187 Views Asked by At

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.

1

There are 1 best solutions below

2
On

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