yesodweb/yesod — pull request #752 by chrisdone (2014-06-07 10:42:04+00:00)
Title: Add support for reloading in GHCi

This adds two files:

* A `.dir-locals.el` file which will be automatically picked up by Emacs and set the right indentation level (`4`) and if the user is using the haskell-mode auto-restart command, it will use GHCi to do so.
* Adds the necessary `DevelMain` file.

I've made about four new Yesod projects so far since first trying the approach [here](https://github.com/chrisdone/ghci-reload-demo#safer-way) and more or less the code is always the same module below which I now tend to copy/paste. This indicates to me that it might be a good time to add it to the scaffold maker.

While the update in-place of the handler (documented [here](https://github.com/chrisdone/ghci-reload-demo#ides-role)) on can often work, more complicated sites with initializations tends to cause GHCi panics, so I'm including in this patch the conservative kill-thread-and-start-thread approach. For small sites there's no speed difference.

May've missed something, this is the first time I've looked at this scaffold stuff, but I've tested that it generates the right files and content:

$ dist/build/yesod/yesod init
…
Project name: x
…
$ ls x/.dir-locals.el x/DevelMain.hs
x/DevelMain.hs x/.dir-locals.el