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 ++--- trivmix.cabal | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) 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 diff --git a/trivmix.cabal b/trivmix.cabal index c986fe2..933f01b 100644 --- a/trivmix.cabal +++ b/trivmix.cabal @@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: trivmix -version: 2.1.0 +version: 2.2.0 -- synopsis: -- description: license: PublicDomain -- cgit v1.2.3