I am using wxHaskell to create a simple GUI that has typical components like Buttons, Panels, etc.
When some of these components perform an action (like callback), the generic status of the application can change.
To keep the status I am using IORef
as a sort of pointer to a generic data structure with all the properties of the status self.
Anyway using IORef
as a sort of top level mutable state is generally not considered a good solution based on https://wiki.haskell.org/Top_level_mutable_state. It might be better State/StateT monad.
wxHaskell is a "bind" to an object oriented library (wxWidgets) and using a State monad is hard unless it's "hooked" to the main event loop thread.
What is the best way to manage a generic GUI status with Haskell in a functional programming way?