[web-devel] Minor delay of Yesod 0.8

Michael Snoyman michael at snoyman.com
Mon Apr 18 16:56:43 CEST 2011

Hi all,

Just wanted to let you know: there's been a minor delay in the 0.8 release
of Yesod, all for good reasons. Rick Richardson and Greg Weber have put in a
lot of work on the MongoDB backend for Persistent, and now we'll be able to
include it (as an alpha) with this release. Congrats to them, this is very

The second reason is that I decided to be naughty and completely disregard
my feature freeze. As we've discussed recently, there are some issues with
our hint-based wai-handler-devel approach. Without going into too many
details (both to keep from boring you, and because I have very little time
before Passover starts), I've made the following modifications to the yesod
scaffolding tool:

* Running "yesod" by itself gives you a list of commands.
* Running "yesod init" gives the behavior previously held by "yesod", i.e.
generate a scaffolded site.
* Running "yesod build" is *almost* identical to "cabal build", but with one
change: it performs a dependency analysis of external files included by
Template Haskell (Hamlet templates, routes, entity definitions) and changes
modification times as needed to force cabal to build modules. For example,
if "Handler/Root.hs" references "hamlet/root.hamlet", and the latter has a
later modification time than the former, the former's modification times
will be changed to match that of the latter.
* Running "yesod devel" runs devel server. Instead of using hint, the devel
server now uses cabal for the compiling (passing in a special "devel" flag)
and direct-plugins to load up the compiled code.

In order to make this work, there are a few necessary modifications to an
individual site:

* The "Controller" module now needs to have a "withDevelApp" function, which
must be of type "Dynamic". The internal type of this must be "(Application
-> IO ()) -> IO ()".
* The cabal file must provide a library section. The library should only be
built when the devel flag is passed in, it should be compiled with "-O0" (to
speed up compiling) and executables are disabled (also for speed).
* direct-plugins can only load up installed packages, so "yesod devel" will
actually install your package.
* The scaffolded site has already been updated to work properly with "yesod
devel", so you can base your modifications on that.

The only bug I'm aware of right now is that if a file disappears at the
wrong time then the call to get the modification time will fail. This may
seem far fetched, but it happened to me when saving a file with vim.
Shouldn't be too hard to fix, I just don't have time right now.

The code's on Yackage. If anyone wants to give it a shot, feel free.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20110418/f092d9be/attachment.htm>

More information about the web-devel mailing list