I'm trying to understand how to use Heist, but none of the examples I find seem to be working and I can't seem to find anyone else that's having the same issue that I am. I found some example code here:
However, when I try to run the first example, I get the following error:
Main.hs:20:15:
‘hcCompiledSplices’ is not a record selector
In the expression:
mempty
{hcCompiledSplices = "foo" ## splice,
hcTemplateLocations = [loadTemplates "."]}
In an equation for ‘heistConfig’:
heistConfig
= mempty
{hcCompiledSplices = "foo" ## splice,
hcTemplateLocations = [loadTemplates "."]}
In the expression:
do { let heistConfig = ...;
heistState <- either (error "oops") id
<$> (runEitherT $ initHeist heistConfig);
builder <- maybe (error "oops") fst
$ renderTemplate heistState "simple";
toByteStringIO B.putStr builder }
Main.hs:22:15:
‘hcTemplateLocations’ is not a record selector
In the expression:
mempty
{hcCompiledSplices = "foo" ## splice,
hcTemplateLocations = [loadTemplates "."]}
In an equation for ‘heistConfig’:
heistConfig
= mempty
{hcCompiledSplices = "foo" ## splice,
hcTemplateLocations = [loadTemplates "."]}
In the expression:
do { let heistConfig = ...;
heistState <- either (error "oops") id
<$> (runEitherT $ initHeist heistConfig);
builder <- maybe (error "oops") fst
$ renderTemplate heistState "simple";
toByteStringIO B.putStr builder }
What am I doing wrong?
Using lenses seems to be the way to do things now.
Also, I change the template
simple.tplto use the tag<h:foo>...</h:foo>instead of just<foo>...</foo>.