Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data ConfigMonoid = ConfigMonoid {}
- data ColorsMonoid = ColorsMonoid {}
- data KeybindingsMonoid = KeybindingsMonoid {}
Documentation
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))
False>>>
_mnormal (l <> r) == First (Just leftStyle)
True
ColorsMonoid | |
|
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,
(declaring an empty
list of mappings) and Just
(fromList
[])
(not declaring anything) are equivalent,
given that there are already default mappings:Nothing
>>>
l <> Just (KeybindingMap (fromList [])) == l <> Nothing
True
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.