【发布时间】:2013-06-07 15:13:20
【问题描述】:
我似乎无法掌握编译的抢劫概念。网络上没有任何例子。我将如何将简单的代码 sn-ps 从解释型更改为编译型。
例如:
listUsersH :: AppHandler ()
listUsersH = do
users <- liftIO $ getColList "users"
let userListS = mapSplices userLinkS users
heistLocal (bindSplice "users" userListS) $ render "list-users"
where
userLinkS d = runChildrenWithText [("user",T.pack $ at "uname" d)]
如何将“runChildren”、“mapSplices”、“bindSplice”和“render”与已编译的抢劫进行简单组合?
我知道这个概念是不同的,没有“heistLocal”。但我现在需要回去重新学习如何做一些基本的事情,比如以“for each”循环的方式显示一堆记录.有人可以澄清这一点并展示一个像上面那样但带有编译抢劫的简单示例吗?
目前我什至不知道如何用编译的抢劫进行简单的变量替换。 例如,这个:
simpleString = "Insert me..."
insertString = heistLocal (bindSplices spl) $ render "tst"
where
spl = [("var", textSplice simpleString)]
请有人帮助我了解基础知识,或者通过一些简单的示例为我指出一个位置。我确实阅读了 snap 网站文档。
【问题讨论】:
标签: haskell haskell-snap-framework