sifflet-2.3.0: Simple, visual, functional language for learning about recursion.

Safe HaskellNone




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 -> CBMgr Source

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.