I'm trying to specify queries in a rest-like manner in my yesod routes, e.g.
mkYesod "HelloWorld" [parseRoutes|
/ HomeR GET
/first/?count=#Int FirstR GET
/second/?count=#Int SecondR GET
|]
But this gives me the following error:
The function `FirstR' is applied to one argument,
but its type `Route HelloYesod' has none
But if I push that #Int
back to being part of the path, it is all fine. I assume this is because the route isn't generated with a parameter?
Is there a way for me to specify that parameter in my route?
No, it's not possible with the current setup, though it's an addition I've considered making in the past. The main reasons I haven't is (1) it would probably make the normal case a bit difficult to achieve, and (2) as josejuan mentions, it's often (though not always) possible to convert this into a route-based parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With