I’m running a program with a graphical interface in wxHaskell.

My program have one button that starts a sometimes very long computation that even could get cyclic in some cases. I created a Stop button that when pressed changes the State of the application (type State = Var MyRecordType from http://wxhaskell.sourceforge.net/doc/Graphics.UI.WX.Types.html#t%3AVar ). Then my very long computation, before calling the recursive call, checks if the State is saying to continue or stop.


In theory this seems the solution but when I tested it I find out that it doesn’t. The very long computation gets the attention of the processor and blocks the graphical interface; clicking the Stop button don’t fire the actions.


I’m not sure but is this running sequencially? Which ways have I to overcome this block?