沙洛姆!我已经使用Yesod编写了以下程序:
main = warp 2060 $
onStatic "home" (dispatchTo $ return $ h1 $ toHtml "Sheepfold")
但是当我运行它时,出现以下错误:
No instance for (YesodDispatch
(Control.Monad.Trans.Writer.Lazy.Writer LiteApp ()))
arising from a use of `warp'
Possible fix:
add an instance declaration for
(YesodDispatch (Control.Monad.Trans.Writer.Lazy.Writer LiteApp ()))
In the expression: warp 2060
In the expression:
warp 2060
$ onStatic "home" (dispatchTo $ return $ h1 $ toHtml "Sheepfold")
In an equation for `main':
main
= warp 2060
$ onStatic "home" (dispatchTo $ return $ h1 $ toHtml "Sheepfold")
有人可以帮忙吗?
最佳答案
您需要使用对liteApp
的调用。参见this example for a demonstration。