From 0f1ceb464f41031650e3f7b8c80002dfc8737c2b Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Mon, 26 Apr 2021 14:08:20 -0400 Subject: [PATCH] Relax more constraints --- src/Ema/Helper/FileSystem.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Ema/Helper/FileSystem.hs b/src/Ema/Helper/FileSystem.hs index 1f6a068..94710e8 100644 --- a/src/Ema/Helper/FileSystem.hs +++ b/src/Ema/Helper/FileSystem.hs @@ -27,7 +27,7 @@ import System.FSNotify import System.FilePath (makeRelative) import System.FilePattern (FilePattern) import System.FilePattern.Directory (getDirectoryFiles) -import UnliftIO (withRunInIO) +import UnliftIO (MonadUnliftIO, withRunInIO) type FolderPath = FilePath @@ -43,7 +43,12 @@ filesMatching parent' pats = do data FileAction = Update | Delete deriving (Eq, Show) -onChange :: forall m. MonadEma m => FolderPath -> (FilePath -> FileAction -> m ()) -> m () +onChange :: + forall m. + (MonadIO m, MonadLogger m, MonadUnliftIO m) => + FolderPath -> + (FilePath -> FileAction -> m ()) -> + m () onChange parent' f = do -- NOTE: It is important to use canonical path, because this will allow us to -- transform fsnotify event's (absolute) path into one that is relative to @@ -62,7 +67,7 @@ onChange parent' f = do liftIO $ threadDelay maxBound `finally` stop withManagerM :: - MonadEma m => + (MonadIO m, MonadUnliftIO m) => (WatchManager -> m a) -> m a withManagerM f = do @@ -71,7 +76,7 @@ withManagerM f = do watchTreeM :: forall m. - MonadEma m => + (MonadIO m, MonadUnliftIO m) => WatchManager -> FilePath -> ActionPredicate ->