From f0dd4aae40e9e476c6066fcc711cd9f1f3f21911 Mon Sep 17 00:00:00 2001 From: Corey O'Connor Date: Wed, 29 Jan 2014 08:13:25 +0100 Subject: [PATCH] have eventecho print out final event --- test/EventEcho.hs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/EventEcho.hs b/test/EventEcho.hs index 12db016..e3dd2c3 100644 --- a/test/EventEcho.hs +++ b/test/EventEcho.hs @@ -17,14 +17,13 @@ type App = RWST Vty () (Seq String) IO main = do vty <- mkVty def - _ <- execRWST vty_interact vty Seq.empty + _ <- execRWST (vty_interact False) vty Seq.empty shutdown vty -vty_interact :: App () -vty_interact = do +vty_interact :: Bool -> App () +vty_interact should_exit = do update_display - done <- handle_next_event - unless done vty_interact + unless should_exit $ handle_next_event >>= vty_interact update_display :: App () update_display = do @@ -36,8 +35,7 @@ update_display = do handle_next_event = ask >>= liftIO . next_event >>= handle_event where - handle_event (EvKey KEsc []) = return True handle_event e = do modify $ (<|) (show e) >>> Seq.take event_buffer_size - return False + return $ e == EvKey KEsc []