vty-ui-1.0: An interactive terminal user interface library for Vty

Graphics.Vty.Widgets.Events

Description

This module provides infrastructure for widgets that need to produce events and provide event handler registration functionality.

Synopsis

Documentation

data Handlers a Source

The type of event handler collections of parameter type a.

type Handler a = a -> IO ()Source

The type of event handlers which take a parameter of type a.

newHandlers :: MonadIO m => m (Handlers a)Source

Create a new event handler collection.

addHandler :: MonadIO m => (w -> m (Handlers a)) -> w -> Handler a -> m ()Source

Given an event handler collection projection combinator, a target, and a handler, add the handler to the target's event handler collection.

fireEvent :: MonadIO m => w -> (w -> m (Handlers a)) -> a -> m ()Source

Fire an event by extracting an event handler collection from a target and invoking all of its handlers with the specified parameter value.