I am using wxHaskell to graphically show the state of a program that advertises state updates using TCP (which I decode using Data.Binary). When an update is received, I want to update the display. So I want the GUI to update its display asynchronously. I know that processExecAsync runs a command line process asynchronously, but I don't think this is what I want.

Here is a toy example of the situation: In a separate process, there is a counter. Every time that the counter is incremented, it sends a message via TCP to other Haskell processes (the clients). The clients manage a gui (in wxHaskell) that displays the value of the counter. When an update is received by the client, I want to update the counter on the display.

Ideally, I would like to spawn a thread to monitor the incoming TCP messages and then update the display from there, but I think this might mess up the event loop.

Many thanks,