summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2014-12-30 17:39:05 +0100
committertv <tv@shackspace.de>2014-12-30 17:39:05 +0100
commit2a0564945d226ed4841e755132a9d10da87a8157 (patch)
tree824653d34cf54c91178a3f5c4d5fe9c1cfbb3168
parentc2d510ad09e13586332981280c068d5c12075905 (diff)
move now into State
-rw-r--r--test5.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/test5.hs b/test5.hs
index d8eb0b5..dc16740 100644
--- a/test5.hs
+++ b/test5.hs
@@ -47,6 +47,7 @@ data State = State
, screenHeight :: Int
, headBuffer :: [Trammel String]
, treeBuffer :: [Trammel String]
+ , now :: UTCTime
}
@@ -65,6 +66,7 @@ initState = do
, screenHeight = 0
, headBuffer = []
, treeBuffer = []
+ , now = UTCTime (fromGregorian 1984 5 23) 49062
}
@@ -142,8 +144,8 @@ winchHandler putEvent =
run :: IO Event -> State -> IO ()
run getEvent = rec where
rec q = rec =<< do
- now <- getCurrentTime
- let q' = render now q
+ t <- getCurrentTime
+ let q' = render q { now = t }
redraw q' >> getEvent >>= processEvent q'
@@ -175,8 +177,8 @@ processEvent q = \case
}
-render :: UTCTime -> State -> State
-render now q@State{..} =
+render :: State -> State
+render q@State{..} =
q { treeBuffer = newTreeBuf
, headBuffer = newHeadBuf
}