Yesod routes and Persistent entities in separate files

Hi all, The Yesod scaffolding tool currently does precisely one thing: produce a scaffolded site. It does *not* provide any facilities for adding new routes or entities after the fact, or creating basic CRUD interfaces the way Rails or Django do. Nubis has proposed adding this functionality. The current roadblock is that the Yesod routes and Persistent entities are defined with quasi-quotation within the code. I believe that technically speaking it should be possible to make this kind of feature work, but it would make more sense to do it as a separate file. I think the proposal would essentially change: mkYesod "MyApp" [$parseRoutes|...|] to mkYesod "MyApp" "MyApp.routes" with the ... being in MyApp.routes, and a similar change for the $persist quasi-quotation. What does everyone think of this? I see the following advantages: * Makes it more straight-forward to write these kinds of scaffolding tools. * Gets away from quasi-quotation for those who have an aversion to it. On the other hand, the downsides are: * One more file to deal with. * The standard issue of Haskell files not automatically recompiling when an external files are changed. This can be worked around with wai-handler-devel. Another possibility is offering *both* options, but as much as possible I'm trying to avoid creating multiple approaches. Michael

While I like the current approach, those downsides are minimal and the potential upsides are appealing. So, +1. -- Felipe.

I've just uploaded web-routes-quasi 0.6.3 which includes
parseRoutesFile and parseRoutesFileNoCheck. Despite what I said
before, I think Yesod *will* provide both approaches (external file
and quasi-quoting), if only to make it easier to create non-scaffolded
sites. But the default scaffolding will use parseRoutesFile instead.
Michael
On Mon, Jan 3, 2011 at 9:59 PM, Felipe Almeida Lessa
While I like the current approach, those downsides are minimal and the potential upsides are appealing. So, +1.
-- Felipe.
participants (2)
-
Felipe Almeida Lessa
-
Michael Snoyman