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

Safe HaskellSafe-Infered

Graphics.UI.Sifflet.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 :: (a -> IO a) -> IORef a -> IO ()Source

Read an IORef, update with IO, and write the updated value. This is like (flip modifyIORef), but the type of the first argument is (a -> IO a) instead of (a -> a). Note that if a = VPUI, then updateIO :: VPUI -> IO VPUI and consequently modifyIORefIO updateIO :: CBMgrAction.