sifflet-lib-1.2: Library of modules shared by sifflet and its tests and its exporters.

Sifflet.UI.Callback

Synopsis

Documentation

type CBMgr = CBMgrCmd -> IO ()Source

The CBMgr (Callback manager) encapsulates (in an enclosure, no less!) an IORef VPUI. It is used *solely* to set up callbacks and similar stuff in Gtk, where the callback needs access to the IORef. By passing a CBMgr to a function, we can avoid passing the IORef directly, and all the harm and confusion that could result.

We only need *one* CBMgr for the application; however, two CBMgrs with the same IORef are logically equivalent, so there would be no harm in having two as long as they share one IORef.

mkCBMgr :: IORef VPUI -> CBMgrSource

Create the CBMgr

modifyIORefIO :: IORef a -> (a -> IO a) -> IO ()Source

Read an IORef, update with IO, and write the updated value. This is like modifyIORef, but the type of the second argument is (a -> IO a) instead of (a -> a).