【发布时间】:2016-03-12 17:11:03
【问题描述】:
我是yesod的初学者。 我正在尝试在 yesod 的路由文件中添加一个“/designmulti/key/#Int/name/#String/finished/#Bool PutDesignMultiR PUT”,但出现错误:
Foundation.hs:46:1:
No instance for (PathPiece Bool)
arising from a use of `toPathPiece'
Possible fix: add an instance declaration for (PathPiece Bool)
是不是说yesod只支持Int和String,不支持Bool? 如何解决? 任何提示将不胜感激! 谢谢。
【问题讨论】:
-
您需要添加
instance PathPiece Bool where ...,它必须描述您希望从 uri 路径中解析布尔值的方式。 -
@pxqr 谢谢。我应该在哪里添加?在 Foundation.hs 中?
-
我想是的。 Yesod 书有this chapter 在 yesod 中解释路由。
-
@pxqr 好的。非常感谢。
-
@SamvelTruzyan 既然你回答了这个问题,也许你应该发表你的评论作为答案?