passing bound names to splices #7

sol opened this Issue Feb 11, 2011 · 3 comments


None yet
3 participants

sol commented Feb 11, 2011

When trying the following

<bind tag="foo">5</bind>

(here fact is bound to factSplice from the tutorial)

it seems that <foo/> is not expanded before the splice is evaluated (which in this case leads to an exception).

Do we want to support the above example? If no, is there a way to do something similar with heist? In particular I'd like to bind some name inside my code with bindString and pass it to a splice.


cdsmith commented Feb 11, 2011

The contents are not pre-processed, but if you want to process them in factSplice, you can use runNodeList to do so. That's by design, since you may want to modify the template state prior to processing children.


sol commented Feb 12, 2011

Nice, thanks. Using getParamNode_ instead of getParamNode with

getParamNode_ = getParamNode >>= runNodeListOnChildren
    runNodeListOnChildren (X.Element t a c) = X.Element t a `liftM` runNodeList c
    runNodeListOnChildren node              = return node

works for me. Do you think it would be beneficial to add something like this to heist (or some other lib, e. g. snap)?


mightybyte commented Mar 20, 2011

Instead of your getParamNode_, wouldn't you want something more like this?

runParamNode = getParamNode >>= runNode

If this does what you want, it seems simple enough that I'm not inclined to include it as another function. Also, I just committed a new function runChildren to git which does something similar, but only renders the children. We'll probably release a new hackage version with this in the near future. If you have any other suggestions about this, it would be great to discuss them before this next release.

@mightybyte mightybyte closed this Oct 12, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment