需要明确的是,我只对使用抢劫感兴趣,而不是快照。我正在阅读 ocharles 的教程(https://ocharles.org.uk/blog/posts/2013-12-11-24-days-of-hackage-heist.html)并尝试修改他的第一个示例。这是一个简单的绑定标签。我的代码如下:
-- main.hs
main :: IO ()
main = billy
billy :: IO ()
billy = do
heistState <- either (error . concat) id <$>
(runEitherT $ initHeist myConfig)
builder <- maybe (error "oops2") fst $
renderTemplate heistState "billy"
toByteStringIO BS.putStr builder
BS.putStr "\n"
myConfig = (set hcNamespace "") $
(set hcInterpretedSplices defaultInterpretedSplices) $
(set hcTemplateLocations [loadTemplates "templates"]) $
emptyHeistConfig
我正在使用的模板:
<bind tag="kiddo">Billy</bind>
Merry Christmas, <kiddo/>!
我得到的输出是这样的:
<bind tag='kiddo'>Billy</bind>
Merry Christmas, <kiddo></kiddo>!
我看不出为什么绑定标签不起作用。实际上,我已经更新了他的代码以使用新的镜头式抢劫配置,并且我知道最近在抢劫中引入的命名空间诡计,但我看不出还有什么需要更改才能使这个示例正常工作。