Event-driven programming in the traditional imperative style.
An event handler is a function that takes an event value and performs some computation.
A value of type
Addhandler a is a facility for registering
event handlers. These will be called whenever the event occurs.
When registering an event handler, you will also be given an action that unregisters this handler again.
do unregisterMyHandler <- register addHandler myHandler
Build a facility to register and unregister event handlers. Also yields a function that takes an event handler and runs all the registered handlers.
do (addHandler, fire) <- newAddHandler register addHandler putStrLn fire "Hello!"