ghci:恢复中断的任务

时间:2016-04-01 14:56:53

标签: haskell emacs ghci

在emacs repl中,我有ghci正在运行。

如果我点击C-c C-c,它会中断某些forever IO,并说

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

我找不到如何恢复该计划。

1 个答案:

答案 0 :(得分:2)

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.