hbro- Minimal extensible web-browser

Safe HaskellNone




Key bindings model. Designed to be imported as qualified.


Key strokes model

data KeyStroke modifier key

A single keystroke is a modifier, and a single key. modifier is usually a Monoid.


KeyStroke modifier key 


Describable KeyStroke 
(Eq m, Eq k) => Eq (KeyStroke m k) 
(Ord m, Ord k) => Ord (KeyStroke m k) 

(.|) :: Monoid modifier => modifier -> key -> KeyStroke modifier key

singleKey :: Monoid m => k -> KeyStroke m k

KeyMap model

type Binding keystroke action = (NonEmpty keystroke, action)

A binding is simply a (non-empty) list of strokes bound to an action

type KeyMap keystroke action = Map (NonEmpty keystroke) action

A non-empty tree implementation that labels edges and leaves type BranchedTree b l = [(b, Tree b l)] data Tree b l = Leaf l | Branch (NonEmpty (b, Tree b l))

KeyMap are stored together in a tree structure type KeyMap keystroke action = BranchedTree keystroke action

type ModalBindings mode keystroke action = Map mode (KeyMap keystroke action)

Modal bindings (à la vi)