
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 cool. 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. Michael

The next step in this is to get the browser to automatically refresh. The
more efficient approach is to use a browser plugin that can listen for a
signal from an application. However, a more convenient default is something
like live.js (livejs.com). Once injected into a page it polls the
application for a new page by making a head request and checking a header
like an ETag.
On Mon, Apr 18, 2011 at 7:56 AM, Michael Snoyman
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 cool.
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.
Michael
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

On Tue, Apr 19, 2011 at 12:56 AM, Michael Snoyman
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 cool. 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.
Does this play nicely with cabal-dev?
* 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. Michael _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- -barkmadley sent from an internet enabled device

It won't play worse with cabal-dev than the previous :)
This is all very beta at the moment, but we will definitely figure out how
to support cabal-dev eventually.
On Mon, Apr 18, 2011 at 5:00 PM, Mark Bradley
On Tue, Apr 19, 2011 at 12:56 AM, Michael Snoyman
wrote: 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 cool. 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.
Does this play nicely with cabal-dev?
* 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. Michael _______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel
-- -barkmadley sent from an internet enabled device
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

On Mon, Apr 18, 2011 at 11:56 AM, Michael Snoyman
* direct-plugins can only load up installed packages, so "yesod devel" will actually install your package.
Wasn't this one of the reasons to ditch/extend direct-plugins? Installing may not be something very consistent with the idea that "yesod devel" invokes, IMHO. Cheers, -- Felipe.

I agree that this isn't optimal (and should be avoided in the long-term), but is it problematic in practice? It seems that the main problem would be if the name conflicted with an existing one- but we are willing to put the burden on the user to create a unique package name. On Mon, Apr 18, 2011 at 5:32 PM, Felipe Almeida Lessa < felipe.lessa@gmail.com> wrote:
On Mon, Apr 18, 2011 at 11:56 AM, Michael Snoyman
wrote: * direct-plugins can only load up installed packages, so "yesod devel" will actually install your package.
Wasn't this one of the reasons to ditch/extend direct-plugins? Installing may not be something very consistent with the idea that "yesod devel" invokes, IMHO.
Cheers,
-- Felipe.
_______________________________________________ web-devel mailing list web-devel@haskell.org http://www.haskell.org/mailman/listinfo/web-devel

On Mon, Apr 18, 2011 at 9:40 PM, Greg Weber
I agree that this isn't optimal (and should be avoided in the long-term), but is it problematic in practice? It seems that the main problem would be if the name conflicted with an existing one- but we are willing to put the burden on the user to create a unique package name.
I just think that somehow the user should be warned that the package is going to be installed. Something like $ ls .yesod_devel_accepted ls: cannot access .yesod_devel_accepted: No such file or directory $ yesod devel This opereration needs to install your package to the user database. Do you want to proceed? You will not be asked again. Proceed? (y/N) y ... $ ls .yesod_devel_accepted .yesod_devel_accepted $ yesod devel ... Cheers, -- Felipe.

good idea. I find prompting annoying though. Perhaps after the scaffold site is generate it can state: Now run your application with the command: "yesod devel" Just a warning: "yesod devel" will install this cabal package in your cabal database. On Mon, Apr 18, 2011 at 5:55 PM, Felipe Almeida Lessa < felipe.lessa@gmail.com> wrote:
I agree that this isn't optimal (and should be avoided in the long-term), but is it problematic in practice? It seems that the main problem would be if the name conflicted with an existing one- but we are willing to put
On Mon, Apr 18, 2011 at 9:40 PM, Greg Weber
wrote: the burden on the user to create a unique package name.
I just think that somehow the user should be warned that the package is going to be installed. Something like
$ ls .yesod_devel_accepted ls: cannot access .yesod_devel_accepted: No such file or directory $ yesod devel This opereration needs to install your package to the user database. Do you want to proceed? You will not be asked again. Proceed? (y/N) y ... $ ls .yesod_devel_accepted .yesod_devel_accepted $ yesod devel ...
Cheers,
-- Felipe.

I think there are three ideas floating around here:
* Installing to the package database is sub-optimal. I'm in agreement here,
this is a stop-gap measure so we can reuse direct-plugins as-is.
* This probably doesn't work with cabal-dev yet. I hope to fix this in the
not-too-distant future. This new approach should make this possible, perhaps
even easy.
* The browser should automatically refresh. wai-handler-devel does this
already via a refresh meta tag (I *think* that's what I used...). Should be
easy to add.
One other thing that I'd like to do: display compile errors in the browser.
That will likely involve grabbing output sent to stderr. In other words, non
trivial, but not particularly difficult.
Consider the implementation as-is for the 0.8.0 release to be alpha, and
we'll hopefully improve upon it quickly.
Michael
On Tue, Apr 19, 2011 at 4:11 AM, Greg Weber
good idea. I find prompting annoying though. Perhaps after the scaffold site is generate it can state:
Now run your application with the command: "yesod devel" Just a warning: "yesod devel" will install this cabal package in your cabal database.
On Mon, Apr 18, 2011 at 5:55 PM, Felipe Almeida Lessa < felipe.lessa@gmail.com> wrote:
I agree that this isn't optimal (and should be avoided in the long-term), but is it problematic in practice? It seems that the main problem would be if the name conflicted with an existing one- but we are willing to put
On Mon, Apr 18, 2011 at 9:40 PM, Greg Weber
wrote: the burden on the user to create a unique package name.
I just think that somehow the user should be warned that the package is going to be installed. Something like
$ ls .yesod_devel_accepted ls: cannot access .yesod_devel_accepted: No such file or directory $ yesod devel This opereration needs to install your package to the user database. Do you want to proceed? You will not be asked again. Proceed? (y/N) y ... $ ls .yesod_devel_accepted .yesod_devel_accepted $ yesod devel ...
Cheers,
-- Felipe.
participants (4)
-
Felipe Almeida Lessa
-
Greg Weber
-
Mark Bradley
-
Michael Snoyman