I'm trying to use renderWithSplices - http://hackage.haskell.org/package/snap-1.0.0.0/docs/Snap-Snaplet-Heist.html#v:renderWithSplices
What is an idiomatic way to get a value of type Splices s (for the second parameter to renderWithSplices)?
I'm trying to use renderWithSplices - http://hackage.haskell.org/package/snap-1.0.0.0/docs/Snap-Snaplet-Heist.html#v:renderWithSplices
What is an idiomatic way to get a value of type Splices s (for the second parameter to renderWithSplices)?
Copyright © 2021 Jogjafile Inc.
The heist tutorial has a couple examples of defining the
Splicestype.If you click on the
Spliceslink in the haddock you linked to above, we see thatSplicesis defined as follows:If you then click on the
MapSyntaxlink, you're taking to the docs for themap-syntaxpackage. This is a small package defining some more convenient syntax for creating maps. There's an example at the top, but the general pattern is as follows:Since the previous definition told us that the keys are text, we can do the following to find out what the type of the values needs to be:
If you have a recent enough GHC (I think 7.8 or higher), the underscore on that last line will create a type hole and cause the compiler to tell you what the type of the thing in that location should be. Then you can write the appropriate thing of that type and it should be more obvious what to do from there.