[web-devel] Kick-off discussion: Yesod 0.9

Simon Michael simon at joyful.com
Tue May 31 01:56:38 CEST 2011

On 5/30/11 4:54 PM, Simon Michael wrote:
> I sent some experience notes on these earlier today, but it doesn't seem to want to show up on this list and I got no
> bounce. Let's see if this one gets through ?

Ha! Quickly, now:

(Fourth attempt to cc web-devel .. moderator, please reject the previous if they show up in your queue)

Hi all,

if you watch the hledger repo or #ledger irc channel, you'll have noticed that hledger-web was upgraded from yesod 0.6 
to 0.8. Also I adopted the organization of yesod's scaffold template app, then simplified that in a way that I like, and 
finally moved all the inline hamlet templates to files (in hledger-web/.hledger/web/templates). I updated the hamlet 
syntax by hand; if I did it over, I would try harder to move to files first and then use the conversion tool provided by 
hamlet. For interest, all this took about 20 hours.

Learning yesod, it sometimes feels over-intricate and obstructive (like when learning haskell..) However all the 
problems I've hit so far had solutions, everything has its place and once you fit the pieces together it all works 
really well. And all the necessary pieces exist. And many of them have great documentation. BIG thanks to Michael and 
the yesod team!

I'm still learning how best to do things but developing the web app has become quite pleasant - I invite you to join in 
and build some really useful financial uis. Here are some notes on running the app:

- The default build, aka yesod's "debug mode", reacts immediately to changes in static files and lucius/cassius/julius 
templates, but not hamlet templates. To see hamlet changes you need to also touch the affected hs files (or all of them) 
and rebuild. Or, use "yesod build" which touches the hs files for you (but doesn't work for me on mac yet.)

- "yesod devel" runs the app in "devel mode", which should quickly rebuild and restart when any template or code file 
changes. I haven't got this to work yet ("Testing files.." repeatedly, nothing running) but this will be the way to go.

- The wai-handler-devel package provides an alternate (deprecated ?) devel mode, which reacts to code changes (but not 
hamlet changes, so touch the hs files for those). I heard it's slower than yesod-devel but it's quicker than a normal 
rebuild/restart. I've got it working with some hardcoded values, let me know if you need that code.

- The "production mode" build (cabal configure -fproduction) has all templates embedded. It still needs to serve the 
static files from disk though, so my write-out-files-on-startup hack is still needed (see EmbeddedFiles.hs). We'll 
probably figure out how to embed the static files too, and then production mode won't need anything from disk.

Next steps: now it's easier to move the web ui forward, and I've been forming some plans
(see http://twitter.com/#!/simonkwmichael/status/74966725057191936). FYI http://demo.hledger.org will keep running the 
latest release, for new visitors, and there's now http://demo.hledger.org:5001 which runs directly out of the trunk 
repo; this will be the place to preview and experiment.

Finally, a random brainstorming question: I'd like to be able to push a button to save the current filtered view as a 
named favourite, and link these in the navigation area for quick access. What's the best scope for these "canned 
reports" - current (top-level) journal file, current directory, current user, ... ? And related but orthogonal: where to 
store them - embedded in the journal, saved in a separate db (using yesod's persistent), attached to the authenticated 
user's settings, ... ?


More information about the web-devel mailing list