aboutsummaryrefslogtreecommitdiff
path: root/src/Wetterhorn/Core/Keys.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wetterhorn/Core/Keys.hs')
-rw-r--r--src/Wetterhorn/Core/Keys.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Wetterhorn/Core/Keys.hs b/src/Wetterhorn/Core/Keys.hs
index 4ed7a77..30db96d 100644
--- a/src/Wetterhorn/Core/Keys.hs
+++ b/src/Wetterhorn/Core/Keys.hs
@@ -14,7 +14,6 @@ module Wetterhorn.Core.Keys
WeakKeyMatcher,
nextKeyEvent,
nextKeyPress,
- keyEvents,
)
where
@@ -74,6 +73,7 @@ modifierToMask m =
-- bindings. This makes it easy to make key-sequence bindings.
newtype KeysM a = KeysM ((KeyEvent -> W ()) -> KeyEvent -> W (KeysMR a))
+-- Return type in the keysM monad.
data KeysMR a = NextKey (KeysM a) | Lift a | Continue
-- | Convert a KeyM operation to a KeyEvent handler.
@@ -140,12 +140,15 @@ instance Monad KeysM where
NextKey sub -> return $ NextKey $ keysJoin sub
Continue -> return Continue
+-- | KeysM can be lifted from a W action.
instance Wlike KeysM where
liftW act = KeysM (\_ _ -> Lift <$> act)
+-- | KeyM can be lifted from an IO action.
instance MonadIO KeysM where
liftIO = liftW . wio
+-- | Reads the current KeyEvent.
instance MonadReader KeyEvent KeysM where
ask = KeysM (\_ -> return . Lift)
local fn (KeysM fn') = KeysM $ \a (fn -> ns) -> fn' a ns