【发布时间】:2011-09-18 01:46:42
【问题描述】:
我尝试在运行时在 hamlet 模板内将参数传递给路由。
buildFeedRow :: Item [Attribute Text] -> GWidget a a ()
buildFeedRow item = do
let f = unpackItem item
u :: Text = url f
[whamlet|
<tr>
<td>
<a href="#{url f}">#{url f}
<td>#{nextCrawlTime f}
<td>#{crawlDelay f}
<td>
<a href="@{DeleteFeedR u}">Delete
<td>Edit |]
由于类型错误而失败。
Couldn't match type `Route a' with `ConsoleRoute'
Expected type: ConsoleRoute -> [(Text, Text)] -> Text
Actual type: Route a -> [(Text, Text)] -> Text
Expected type: GHandler
a a (ConsoleRoute -> [(Text, Text)] -> Text)
Actual type: GGHandler
a
a
(Data.Enumerator.Iteratee Data.ByteString.Internal.ByteString IO)
(Route a -> [(Text, Text)] -> Text)
In the first argument of `lift', namely `getUrlRenderParams'
In the first argument of `(>>=)', namely `lift getUrlRenderParams'
我的问题是如何将参数传递给 hamlet 模板中的路由。
【问题讨论】:
-
我看不出这段代码有什么问题,我猜这里还有别的东西在起作用。也许尝试添加一些类型签名,或者在您的 sn-p 中包含更多周围的代码。