gpt4 book ai didi

haskell - 使用 warp 时出现 "no instance for YesodDispatch"错误

转载 作者:行者123 更新时间:2023-12-02 03:36:47 24 4
gpt4 key购买 nike

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

关于haskell - 使用 warp 时出现 "no instance for YesodDispatch"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22862617/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com