| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vgrep.Environment.Config.Monoid
Synopsis
- 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.
Constructors
| ConfigMonoid | |
Fields | |
Instances
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
Constructors
| ColorsMonoid | |
Fields
| |
Instances
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 <> rJust (KeybindingMap {unKeybindingMap = fromList [(Chord (fromList []) Up,ResultsUp),(Chord (fromList []) Down,ResultsDown)]})>>>r <> lJust (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 <> NothingTrue
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.
Constructors
| KeybindingsMonoid | |