
haskell@stefan-klinger.de writes:
On 2015-Aug-12, mikael.brockman@gmail.com wrote with possible deletions:
But could one get away with using `handle` at the particular sites where one expects to be interrupted, e.g. around the call to `threadDelay`?
Yeah, I've had that, but I don't like it: When the user's wetware decides that somethig takes longer than expected, it decides to press Ctrl-C. Now the calculation might just terminate an instant before the keypress, yielding a race condition between whether the interrupt is caught, or not (or by which exception handler). Also, pressing C-c (un)intentionally at the prompt would either terminate the program, or reset all settings made in the interactive session, thats way more than I'd like to happen.
But thanks for the idea... Stefan
Maybe keeping the state in an I/O variable is the most viable way. I can't explain clearly why that would be the case, but it seems tricky to work "externally" with the state carried by StateT, since it only exists in the transient form of a value threaded through lambdas...