1
1
mirror of https://github.com/srid/ema.git synced 2024-11-29 09:25:14 +03:00

Relax more constraints

This commit is contained in:
Sridhar Ratnakumar 2021-04-26 14:08:20 -04:00
parent 767b9b471b
commit 0f1ceb464f

View File

@ -27,7 +27,7 @@ import System.FSNotify
import System.FilePath (makeRelative) import System.FilePath (makeRelative)
import System.FilePattern (FilePattern) import System.FilePattern (FilePattern)
import System.FilePattern.Directory (getDirectoryFiles) import System.FilePattern.Directory (getDirectoryFiles)
import UnliftIO (withRunInIO) import UnliftIO (MonadUnliftIO, withRunInIO)
type FolderPath = FilePath type FolderPath = FilePath
@ -43,7 +43,12 @@ filesMatching parent' pats = do
data FileAction = Update | Delete data FileAction = Update | Delete
deriving (Eq, Show) 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 onChange parent' f = do
-- NOTE: It is important to use canonical path, because this will allow us to -- 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 -- 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 liftIO $ threadDelay maxBound `finally` stop
withManagerM :: withManagerM ::
MonadEma m => (MonadIO m, MonadUnliftIO m) =>
(WatchManager -> m a) -> (WatchManager -> m a) ->
m a m a
withManagerM f = do withManagerM f = do
@ -71,7 +76,7 @@ withManagerM f = do
watchTreeM :: watchTreeM ::
forall m. forall m.
MonadEma m => (MonadIO m, MonadUnliftIO m) =>
WatchManager -> WatchManager ->
FilePath -> FilePath ->
ActionPredicate -> ActionPredicate ->