From 3576f981b8e1ea2e23dafc6351c52e614b0dc13c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 9 Jun 2015 22:55:40 +0200 Subject: code cleanup --- src/Trivmix.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Trivmix.hs') diff --git a/src/Trivmix.hs b/src/Trivmix.hs index ede6f67..fe592fe 100644 --- a/src/Trivmix.hs +++ b/src/Trivmix.hs @@ -140,13 +140,12 @@ handleFiles inotify level files = do initLevel <- readMVar level levelChanges <- (newChan :: IO (Chan Level)) let - handleFiles' = mapM handleFile files handleFile file = do levelChanges' <- dupChan levelChanges forkIO $ forever $ do -- Broadcast level changes and update all files readChan levelChanges' >>= writeLevel file addWatch inotify watchedAttrs file (const $ readLevel levelChanges level file) - foldl (.) id [onStateFile f (show initLevel ++ "\n") | f <- files] $ handleFiles' + sequence [onStateFile f (show initLevel ++ "\n") handleFile f | f <- files] forkIO $ forever $ do readChan levelChanges >>= swapMVar level return () @@ -171,7 +170,7 @@ onStateFile file initial action = do False -> removeFile file releaseDir = case dirExists of True -> return () - False -> removeFile directory + False -> removeDirectory directory acquire = acquireFile release = releaseFile >> releaseDir bracket_ acquire release action -- cgit v1.2.3