1
要清楚,我只用搶劫興趣,不折斷。我讀通過ocharles的教程(https://ocharles.org.uk/blog/posts/2013-12-11-24-days-of-hackage-heist.html),並努力適應他的第一個例子。這是一個簡單的綁定標籤。我的代碼如下:四處搶劫0.14.0.1工作
-- 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>!
我看不出爲什麼綁定標籤沒有按沒有工作。其實我已經更新了他的代碼,以使用新的鏡頭風格搶劫配置,而且我知道,這是最近有點介紹了搶劫的命名空間掛羊頭賣狗肉,但我看不出還有什麼需要改變,以得到這個例子的工作。
你能告訴你所有的進口? – ErikR 2014-12-13 16:38:07