I am considering writing a program such as the Qt Mandelbrot Example . This example sets up the partitioning GUI / Worker, where the calculation is performed in the background thread. Since iteratively provided in more detail, image data is sent back to the GUI window for display. If the mouse rotates or scales while progress is being calculated. The old calculation is “canceled” and will no longer start.
(Note: there is no way to safely just kill the current thread in C ++. Therefore, the worker should check the restartboolean from time to time at the points of the calculation loop ... in cooperative multitasking.)
As a person new to Haskell, I wonder what kind of regression someone will have for even a very simple version of this. I read about functional reactive programming , and that makes (some) sense to me. But I did not find anything about asking for a long calculation, getting progressive results from this calculation over time, and then pulling the carpet out of the calculation based on what the user did to start a new one.
This is what I found in the search, and I'm not sure how appropriate it is:
How to write a Ctrl-C handler in Haskell?
KillThread in GHC concurrency has security that is not available on other systems; what can be used to cancel this form? Killed computing will not be involved in the operation of the graphical interface - their work will be where the GHC controls the situation. But they still need a way to gradually communicate their progress back to the interface. Therefore, during this alarm, it can use some OS and be an "unsafe time".
source
share