diff options
author | tv <tv@shackspace.de> | 2014-12-30 17:39:05 +0100 |
---|---|---|
committer | tv <tv@shackspace.de> | 2014-12-30 17:39:05 +0100 |
commit | 2a0564945d226ed4841e755132a9d10da87a8157 (patch) | |
tree | 824653d34cf54c91178a3f5c4d5fe9c1cfbb3168 | |
parent | c2d510ad09e13586332981280c068d5c12075905 (diff) |
move now into State
-rw-r--r-- | test5.hs | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 } |