我一直在编写一个应用程序,它使用JSON数据,然后使用Happstack显示数据。
helloBlaze :: ServerPart Response
helloBlaze =
ok $ toResponse $
appTemplate "Hello, Blaze!"
[H.meta ! A.name "keywords"
! A.content "happstack, blaze, html"
]
(do H.toHtml $ makeList $ getResponse)
makeList xs = "<ul>" ++ (Items xs) ++ "</ul>"
Items [] = ""
Items (x:xs) = "<li>" ++ x ++ "</li>" ++ (Items xs)问题是,当我运行Happstack时,生成的响应是结果,但仍然显示html标记。任何建议都将不胜感激。
发布于 2015-05-07 17:21:39
我不太了解Blaze,但正确的方法不是像这样
makeList xs = ul (mapM_ li xs)这就是它的工作原理,不是吗?
(另外,不要使用Items作为函数名。它需要以小写字母开头。)
https://stackoverflow.com/questions/30096729
复制相似问题