Safe Haskell | Safe-Infered |
---|
- type AddHandler a = (a -> IO ()) -> IO (IO ())
- newAddHandler :: IO (AddHandler a, a -> IO ())
- mapIO :: (a -> IO b) -> AddHandler a -> AddHandler b
- filterAddHandler :: (a -> IO Bool) -> AddHandler a -> AddHandler a
Synopsis
Various utility functions concerning event handlers.
Documentation
type AddHandler a = (a -> IO ()) -> IO (IO ())Source
A value of type AddHandler a
is just a facility for registering
callback functions, also known as event handlers.
The type is a bit mysterious, it works like this:
do unregisterMyHandler <- addHandler myHandler
The argument is an event handler that will be registered. The return value is an action that unregisters this very event handler again.
newAddHandler :: IO (AddHandler a, a -> IO ())Source
Build a facility to register and unregister event handlers.
mapIO :: (a -> IO b) -> AddHandler a -> AddHandler bSource
Apply a function with side effects to an AddHandler
filterAddHandler :: (a -> IO Bool) -> AddHandler a -> AddHandler aSource
Filter event occurrences that don't return True
.