Search code examples
haskellemacsghci

ghci : resume an interrupted task


in the emacs repl, I have ghci running.

if I hit C-c C-c, it interrupts some forever IO, and says

λ> server1
Listening on port 4444Accepted connection from localhost: 57441
Accepted connection from localhost: 57444
Accepted connection from localhost: 57447
Interrupted.

I can't find how to resume the program.


Solution

  • As the comments describe, you can't "resume" a task here. What happened is that you threw a signal, which was turned into a runtime exception. This exception terminated the thread. You can start a new task up again, but the thread didn't have a mechanism to "catch and suspend".

    You could add such a mechanism -- for example to create your server thread as a separate thread along with a "resume" MVar, then then have it catch signals on exceptions, and then block on reading from the MVar.