keyHandlersFromConfig: cleanup

This commit is contained in:
Jonathan Daugherty 2022-07-10 13:56:41 -07:00
parent 6c1f357318
commit 6466c4e99d

View File

@ -106,14 +106,13 @@ keyHandlersFromConfig :: (Ord e)
-> KeyEventHandler e m
-> [KeyHandler e m]
keyHandlersFromConfig kc eh =
case kehEventTrigger eh of
Static binding ->
[ KH eh binding ]
ByEvent ev ->
[ KH eh b | b <- allBindings ]
where allBindings | Just (BindingList ks) <- lookupKeyConfigBindings kc ev = ks
| Just Unbound <- lookupKeyConfigBindings kc ev = []
| otherwise = allDefaultBindings kc ev
let allBindingsFor ev | Just (BindingList ks) <- lookupKeyConfigBindings kc ev = ks
| Just Unbound <- lookupKeyConfigBindings kc ev = []
| otherwise = allDefaultBindings kc ev
bindings = case kehEventTrigger eh of
Static binding -> [binding]
ByEvent ev -> allBindingsFor ev
in [ KH eh b | b <- bindings ]
mkHandler :: T.Text -> m () -> Handler m
mkHandler msg action =