我试图在我的yesod路由中以类似休息的方式指定查询,例如
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
/first/?count=#Int FirstR GET
/second/?count=#Int SecondR GET
|]
Run Code Online (Sandbox Code Playgroud)
但这给了我以下错误:
The function `FirstR' is applied to one argument,
but its type `Route HelloYesod' has none
Run Code Online (Sandbox Code Playgroud)
但是,如果我把它推#Int
回到路径的一部分,那一切都很好.我假设这是因为路由不是用参数生成的?
有没有办法在我的路线中指定该参数?
Mic*_*man 10
不,目前的设置是不可能的,尽管这是我过去考虑过的一个补充.我没有的主要原因是(1)它可能会使正常情况有点难以实现,并且(2)正如josejuan所提到的,通常(尽管不总是)可以将其转换为基于路径的参数.