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

Safe HaskellSafe-Inferred

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 :: IO (Handlers a)Source

Create a new event handler collection.

addHandler :: (w -> IO (Handlers a)) -> w -> Handler a -> IO ()Source

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

fireEvent :: w -> (w -> IO (Handlers a)) -> a -> IO ()Source

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