From fdace9e83af6545e919dc3883bdb52b32b1f43b2 Mon Sep 17 00:00:00 2001 From: Gurkenglas Date: Wed, 3 Aug 2016 14:21:46 +0200 Subject: [PATCH] Refactor multiThreadedLoop I morally count retry in a case match as recursion. --- src/Rumpus/Main.hs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Rumpus/Main.hs b/src/Rumpus/Main.hs index 67c38ce..a71e730 100644 --- a/src/Rumpus/Main.hs +++ b/src/Rumpus/Main.hs @@ -117,11 +117,9 @@ multiThreadedLoop ghc pd vrPal = do makeContextCurrent (Just (gpThreadWindow vrPal)) void . flip runStateT startingECS . forever $ do (headM44, events) <- atomically $ do - readTVar backgroundBox >>= \case - Just something -> do - writeTVar backgroundBox Nothing - return something - Nothing -> retry ++ something <- fmap (fromJustNote "asum . repeat") $ asum $ repeat $ readTVar backgroundBox ++ writeTVar backgroundBox Nothing ++ return something profile "Controls" $ tickControlEventsSystem headM44 events tickLogic