summaryrefslogtreecommitdiff
path: root/trivmix/Trivmix.hs
diff options
context:
space:
mode:
Diffstat (limited to 'trivmix/Trivmix.hs')
-rw-r--r--trivmix/Trivmix.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/trivmix/Trivmix.hs b/trivmix/Trivmix.hs
index 5cddf6f..7c18965 100644
--- a/trivmix/Trivmix.hs
+++ b/trivmix/Trivmix.hs
@@ -194,7 +194,9 @@ trivmix Options{..} = do
194 mulBalance (bToScientific -> b) x = either error id $ asScientific (*) (Lin . either error id $ refine b) x 194 mulBalance (bToScientific -> b) x = either error id $ asScientific (*) (Lin . either error id $ refine b) x
195 newLevel <- mulBalance <$> readMVar balance <*> readMVar level 195 newLevel <- mulBalance <$> readMVar balance <*> readMVar level
196 currentLevel <- (\(CFloat f) -> Lin . either error id . refine $ realToFrac f) <$> readMVar level' 196 currentLevel <- (\(CFloat f) -> Lin . either error id . refine $ realToFrac f) <$> readMVar level'
197 mapM_ (\x -> (swapMVar level' $! toRealFloat . unrefine . toLin $ linInt' x currentLevel newLevel) >> threadDelay delay) (takeWhile (<= 1) $ iterate (+ recip frames) 0) 197 case compare currentLevel newLevel of
198 EQ -> threadDelay . round $ interval * 1e6
199 _ -> mapM_ (\x -> (swapMVar level' $! toRealFloat . unrefine . toLin $ linInt' x currentLevel newLevel) >> threadDelay delay) (takeWhile (<= 1) $ iterate (+ recip frames) 0)
198 notifyReady 200 notifyReady
199 forever $ threadDelay (round $ watchdogInterval * 1e6) >> notifyWatchdog 201 forever $ threadDelay (round $ watchdogInterval * 1e6) >> notifyWatchdog
200 202