使用warp时出现“YesodDispatch没有实例”错误

时间:2014-04-04 12:17:33

标签: haskell web functional-programming yesod

沙洛姆!我使用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")

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:1)

您需要拨打liteApp。请参阅this example for a demonstration