There is some issue with Ctrl-C and windows in general. I am not really clear on the details. Maybe someone who uses windows can come up with a better fix.
The easiest thing to do is to use forkIO
and waitForTermination
do tid <- forkIO $ simpleHTTP nullConf yourApp
waitForTermination
killThread tid
waitForTermination
just blocks until it receives the termination signal. On unix platforms, that is ^C. Under windows it is the letter 'e' (for exit). You might have to press the return
key depending on buffering.
Under linux, you can use happstack-plugins/plugins-auto to automatically recompile and reload changes into the running server whenever the source files are saved. However, plugins-auto does not currently support Windows because it relies on the inotify library which is linux specific. There is some work underway to generalize the inotify support so that it can be used when available, and use a polling solution under windows.
To see an older demo of plugins-auto check out:
http://happstack.blogspot.com/2010/10/recompile-your-haskell-based-templates.html