此代码在0.10.0更改之前使用Heist
main = do
Right ts <- loadTemplates "templates" $
bindSplices mySplices defaultHeistState
etc..现在我得到了错误
testdb.hs:59:33: Not in scope: `defaultHeistState'我知道loadTemplates的类型签名已更改为
loadTemplates :: FilePath -> EitherT [String] IO TemplateRepoSource但我很难弄清楚如何调整我的旧代码以使其工作。
发布于 2013-02-10 08:39:58
好的,我用它来工作,但是我愿意用更优雅的方式来做这件事
load baseDir splices = do
tmap <- runEitherT $ do
templates <- loadTemplates baseDir
let hc = HeistConfig mySplices [] [] [] templates
initHeist hc
either (error . concat) return tmap
main = do
ts <- load "templates" $ bindSplices mySplices
renderWithArgs [("test", T.pack "hello world")] ts "index" >>=
B.putStr . maybe "Page not found" (toByteString . fst) https://stackoverflow.com/questions/14793272
复制相似问题