vgrep- A pager for grep

Safe HaskellNone




data ConfigMonoid Source #

A Monoid for reading partial configs. The ConfigMonoid can be converted to an actual Config using fromConfigMonoid.

The Monoid consists mostly of 'First a' values, so the most important config (the one that overrides all the others) should be read first.

data ColorsMonoid Source #

A Monoid for reading partial Colors configurations.

Note that the attributes are not merged, but overridden:

>>> import Graphics.Vty.Attributes
>>> let leftStyle  = defAttr `withStyle` standout
>>> let rightStyle = defAttr `withForeColor` black
>>> let l = mempty { _mnormal = First (Just leftStyle)}
>>> let r = mempty { _mnormal = First (Just rightStyle)}
>>> _mnormal (l <> r) == First (Just (leftStyle <> rightStyle))
>>> _mnormal (l <> r) == First (Just leftStyle)


Eq ColorsMonoid Source # 
Show ColorsMonoid Source # 
Generic ColorsMonoid Source # 

Associated Types

type Rep ColorsMonoid :: * -> * #

Monoid ColorsMonoid Source # 
type Rep ColorsMonoid Source # 

data KeybindingsMonoid Source #

A Monoid for reading a partial Keybindings configuration.

Mappings are combined using left-biased union:

>>> let l = Just (KeybindingMap (fromList [(Key.Chord mempty Key.Down, ResultsDown), (Key.Chord mempty Key.Up, ResultsUp)]))
>>> let r = Just (KeybindingMap (fromList [(Key.Chord mempty Key.Down, PagerDown)]))
>>> l <> r
Just (KeybindingMap {unKeybindingMap = fromList [(Chord (fromList []) Up,ResultsUp),(Chord (fromList []) Down,ResultsDown)]})
>>> r <> l
Just (KeybindingMap {unKeybindingMap = fromList [(Chord (fromList []) Up,ResultsUp),(Chord (fromList []) Down,PagerDown)]})

In particular, Just (fromList []) (declaring an empty list of mappings) and Nothing (not declaring anything) are equivalent, given that there are already default mappings:

>>> l <> Just (KeybindingMap (fromList [])) == l <> Nothing

This means that new keybindings override the previous ones if they collide, otherwise they are simply added. To remove a keybinding, it has to be mapped to Unset explicitly.