
Hi, I recently started experimenting using the FFI in GHC and GHCi. In GHCi, one would like to press control-C in the middle of a computation, and get back to the prompt. It is however hard to understand how control-C and the foreign function calls interact. I noticed that GHCi does not react to control-C when the program in inside a foreign function. Instead, it then breaks when the foreign function comes back. This behavior would be fine in many applications if it were consistent. However, often after I have pressed control-C, the internal state of the foreign library is usually completely messed up. Even beyond what one can think is possible when allowing to abruptly break computations. So, my questions are: 1) Does anyone know what exactly happens when control-C is pressed during foreign function evaluation? 2) Does anyone know how this can be controlled in a more finegrained way? For example, in old Hugses, it was possible to use the function "breakOn", which allowed/disallowed control-C breaking. /Koen.