[Haskell-cafe] Web servers: Running them multiple times in a ghci session

Niklas Hambüchen mail at nh2.me
Thu Apr 11 07:03:30 CEST 2013


I'm writing a web server app, which I run in ghci:

:main localhost 8000

Unfortunately, after Ctrl-C and :reload, running it again:

** Exception: bind: resource busy (Address already in use)

This is pretty annoying, because quitting-and-restarting takes a lot of
time since I have many dependencies.

How do you deal with this? Can you propose some working code that can be
wrapped around my main function to make it work?

My first idea is running main in a separate process.

If you have a working idea, please also post it as an answer on
http://stackoverflow.com/questions/15890912/how-do-i-terminate-a-socket-server-in-ghci

Thanks



More information about the Haskell-Cafe mailing list