hbro-1.1.2.0: Minimal KISS compliant browser

Safe HaskellNone

Hbro.Keys

Description

Key bindings model. Designed to be imported as qualified.

Synopsis

Documentation

data Tree edge leaf Source

A tree implementation that labels edges

Constructors

Empty 
Leaf leaf 
Branch (Map edge (Tree edge leaf)) 

Instances

(Show edge, Show leaf) => Show (Tree edge leaf) 

type Stroke = (Set Modifier, String)Source

A single keystroke, i.e. a set of modifiers and a single key (its string description)

type Bindings m = Tree Stroke (m ())Source

List of keys bound to actions

data Mode Source

Constructors

Normal 
Insert 

Instances

data Status Source

Global state

Constructors

Status 

Fields

_mode :: Mode

Current mode

_strokes :: [Stroke]

Previous keystrokes

Instances

class StatusReader m whereSource

MonadReader for Status

Methods

readStatus :: Simple Lens Status a -> m aSource

Instances

class StatusWriter m whereSource

MonadWriter for Status

Methods

writeStatus :: Simple Lens Status a -> a -> m ()Source

Instances

type StatusState m = (StatusReader m, StatusWriter m)Source

MonadState for Status

merge :: Ord a => Tree a b -> Tree a b -> Tree a bSource

In case of conflicts, the rightmost operand is preferred

lookup :: Ord a => [a] -> Tree a b -> Maybe (Tree a b)Source

deserialize :: String -> Maybe [Stroke]Source

Parse a String representation of a keystrokes chain

toBindings :: [(String, m ())] -> Bindings mSource