aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Chelleport.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Chelleport.hs b/src/Chelleport.hs
index 6b443b5..98d1aa6 100644
--- a/src/Chelleport.hs
+++ b/src/Chelleport.hs
@@ -30,7 +30,7 @@ run = do
ctx
(runEff ctx initialState)
(\state -> runEff ctx . update state)
- eventToAction
+ (const eventHandler)
(runEff ctx . Chelleport.View.render)
initialState :: (MonadIO m) => m State
@@ -48,8 +48,8 @@ initialState = do
columns = 16
hintKeys = ['A' .. 'Z'] \\ "Q"
-eventToAction :: EventHandler State AppAction
-eventToAction _state event =
+eventHandler :: SDL.Event -> Maybe AppAction
+eventHandler event =
case SDL.eventPayload event of
SDL.QuitEvent -> Just ShutdownApp
SDL.KeyboardEvent ev
@@ -72,8 +72,8 @@ update ::
m (State, Maybe AppAction)
-- Act on key inputs
update state (HandleKeyInput key) = do
- case liftA2 (,) (toKeyChar key) validChars of
- Just (keyChar, validChars')
+ case (toKeyChar key, validChars) of
+ (Just keyChar, Just validChars')
| stateIsMatched state && keyChar `elem` ("HJKL" :: String) -> do
incr <- incrementValue
let action = IncrementMouseCursor $ directionalIncrement incr keyChar