[Haskell] How to use STM in GUI applications?

Lemmih lemmih at gmail.com
Mon Dec 4 17:31:15 EST 2006

On 12/4/06, Thorsten Seitz <thorsten.seitz at web.de> wrote:
> Hello,
> I'm very intrigued by the concepts of STM but I'm having difficulties to see
> how a TVar based model can be used by a GUI application (e.g. Gtk2hs):
> For example, I'd like to update the GUI (e.g. changing widget sensitivity)
> upon changes in the model.
> But changing the sensitivity of a widget is an IO operation which cannot be
> initiated atomically by a model change which is an STM operation. Therefore
> the GUI change cannot be executed atomically together with the model change.
> This means for example that I can still press a button although the model has
> changed such that the button action is not allowed anymore. All I can do is
> check the condition of the model when the button is pressed and then ignore
> the button press which is not very satisfying for the user.
> Is it simply not appropriate to use TVar based models in a GUI application?
> Maybe STM should be more used like a service for MVar based GUI models?

How about making a list of IO actions to be executed when the
transaction commits?


More information about the Haskell mailing list