I'm working on a web server using Scotty. I can run ghci and keep using :r to get it to reload my code, but if I even run main I cant' restart the web server without killing ghci.
How can I cancel main without closing ghci? Is there a better way to handle web servers and automatically restart them?
Invoke :set args <arg> ... in ghci to set the arguments that will be returned by System.getArgs.
Then, using the async package, launch the server in ghci with something like a <- async main.
Later invoke cancel a to kill the server.
See also this link that explains how to reload code even while the server is running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With