From 4f9f222bc91f4bcd505cb584cbcc874c86b529c8 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 9 Jun 2015 23:41:57 +0200 Subject: Now only looping until fixpoint --- src/Trivmix.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Trivmix.hs') diff --git a/src/Trivmix.hs b/src/Trivmix.hs index 69fcea2..425de4a 100644 --- a/src/Trivmix.hs +++ b/src/Trivmix.hs @@ -194,8 +194,10 @@ readLevel levelChan current file = catch action handler where action = do level <- readFile file >>= readIO . stripSpace - writeChan levelChan level - hPutStrLn stderr $ "Detected new level: " ++ (show level) + oldLevel <- readMVar current + when (oldLevel /= level) $ do + writeChan levelChan level + hPutStrLn stderr $ "Detected new level: " ++ (show level) handler e = if isUserError e then do hPutStrLn stderr $ "Could not parse new level from ‘" ++ file ++ "’ - overwriting." -- cgit v1.2.3