Hey guys,
I have a couple of things I want to talk about today.
First: attached is a message from Jeremy Shaw, the happstack maintainer. He
makes a pretty compelling case for moving everyone over to a common framework
for doing dynamic page reloading.
His solution is based on Don's "plugins' library, and has a couple of big
advantages over ours:
- it *compiles* the code so you don't pay much of a performance penalty in
development mode
- it watches your source directory using inotify so that the code is only
recompiled when it needs to be
There are a couple of areas where it would need to be hacked in order to be
suitable for our purposes:
- An inotify dependency is not going to fly for us. Instead, what we need to
do on platforms which don't support inotify is to scan the source directory
periodically (every 5 seconds or so?), guarded by an activity latch.
- We need to adapt it to handle our init/handle/teardown cycle.
I don't want to waste the excellent work you guys have put into making hint
work as a rapid development backend, but on paper the plugins approach is
clearly superior for a couple of really important technical reasons. Any
comments or objections?
* * *
Second: I'm writing an article about Snap that will appear in print sometime in
January. Rather than hedge my bets re: the new features we expect to be in Snap
0.3 (dynamic reloading, etc) by saying "well, we're working on this stuff but
at the time of the writing of this article it isn't out yet blah blah blah",
I'm thinking of biting the bullet and writing it as if this stuff was out
already. This would set a firm January deadline for the release of Snap 0.3: is
this overly optimistic? Can we commit to having this stuff be out by then?
G.
--
Gregory Collins <[email protected]>
---------- Forwarded message ----------
From: Jeremy Shaw <[email protected]>
Date: Sat, Nov 6, 2010 at 5:45 AM
Subject: Re: Yesod/Happstack/Snap matrix
To: Michael Snoyman <[email protected]>
Cc: Gregory Collins <[email protected]>
In terms of group projects, I would like to see some unification in
the plugins / hint dynamic reloading space.
happstack, yesod, and snap all perform some form of dynamic reloading,
but I am not really clear on what the differences and advantages are.
But, the happstack-plugins code, for example, is 90% not happstack
specific. It would make sense to do something like web-routes, where
there is a core library and then -snap, -happstack, -yesod packgaes
for the framework glue.
Here are the cool parts of happstack-plugins:
1. it uses hinotify to automatically detect when a 'plugin' file is
saved, and to recompile and reload the code (included updates to
dependencies, and adding new dependency watching when you add new
imports).
2. it really compiles the code, so you should incur little speed
reduction by using plugins
3. it leverages the type-checker to make sure the plugins had the
correct type at compile time (if you change the plugin type after the
app is already running, then you will, of course, get a runtime error)
4. you can easily easily switch between static and dynamic loading so
that your live server does not need to have GHC linked into it or any
extra call overhead.
5. because it only recompiles and reloads the changed modules, it is
often very fast. Much faster than recompiling and relinking an
application with only one modified module[1]. And much faster than
restarting and reloading everything into the GHCi.
6. reloading a plugin does not involve restarting the entire app --
it can happen while other threads are still running.
How do the hint based solutions compare? I really have no idea how you
guys are using hint. I used plugins, because I already knew how it
worked and knew it did what I wanted. But I am not committed to
sticking with it.
Can you actually use hint interactively ? That would be nice for
happstack-state applications, because you could interactively inspect
and play with the state instead of having to compile code which is a
bummer...
- jeremy
[1] I believe you have all seen the blog post and screencast, but if
not, http://happstack.blogspot.com/2010/10/recompile-your-haskell-based-templates.html
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap