平安!我使用 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 .