aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaúl Benencia <rul@kalgan.cc>2013-08-25 18:11:50 -0300
committerRaúl Benencia <rul@kalgan.cc>2013-08-25 18:11:50 -0300
commit3e861fe72dbdbd819aed7c67dddb4e820dee0f66 (patch)
tree15df4f7d530ee1db1d969b7caba93e74506e8451
parentf25d0d8d82dff0be2d68476148479004b2888bd7 (diff)
refactored screenLoop
-rw-r--r--Screen.hs13
1 files changed, 5 insertions, 8 deletions
diff --git a/Screen.hs b/Screen.hs
index df426fd..b253452 100644
--- a/Screen.hs
+++ b/Screen.hs
@@ -60,16 +60,14 @@ startCurses = do
screenLoop :: LazymailCurses ()
screenLoop = do
w <- liftCurses $ defaultWindow
- st <- get
cfg <- ask
- (_, st') <- liftCurses $ updateWindow w $ runStateT (runReaderT performUpdate cfg) st
- put st'
+ get >>= \st ->
+ (liftCurses . (updateWindow w) $ runStateT (runReaderT performUpdate cfg) st) >>= put . snd
liftCurses $ render
handleEvent
- st <- get
- if (not . exitRequested) st
- then screenLoop
- else return ()
+ get >>= \st -> if (not . exitRequested) st
+ then screenLoop
+ else return ()
--performUpdate :: LazymailUpdate ()
performUpdate = do
@@ -121,7 +119,6 @@ clearMain rows columns = do
then drawEmptyLine $ currentRow + 1
else return ()
-
-- | Helper function of drawMode
drawIndexHelper [] = resetCurrentRow
drawIndexHelper ((fp, _, msg):ts) = do
nihil fit ex nihilo