packages feed

reflex-fsnotify 0.2.0.0 → 0.2.1.0

raw patch · 3 files changed

+20/−4 lines, 3 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Reflex.FSNotify: type FSEvent = Event
+ Reflex.FSNotify: watchDirs :: (Reflex t, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m)) => WatchConfig -> Event t [FilePath] -> ActionPredicate -> m (Event t FSEvent)
- Reflex.FSNotify: wrapWatch :: (Reflex t, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m)) => (WatchManager -> FilePath -> Action -> IO a) -> WatchConfig -> Event t FilePath -> m (Event t FSEvent)
+ Reflex.FSNotify: wrapWatch :: (Reflex t, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m)) => (WatchManager -> pathinfo -> Action -> IO a) -> WatchConfig -> Event t pathinfo -> m (Event t FSEvent)

Files

ChangeLog.md view
@@ -1,5 +1,10 @@ # Revision history for reflex-fsnotify +## 0.2.1.0++* Add `watchDirs` to watch a list of directories+* Generalize `wrapWatch` a little to make `watchDirs` possible+ ## 0.2.0.0  * Deprecate `watchDirectory`
reflex-fsnotify.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: reflex-fsnotify-version: 0.2.0.0+version: 0.2.1.0 synopsis: reflex-frp interface for watching files description: Receive FRP events whenever files change. bug-reports: https://github.com/reflex-frp/reflex-fsnotify/issues
src/Reflex/FSNotify.hs view
@@ -7,10 +7,12 @@ module Reflex.FSNotify   ( watchDirectory   , watchDir+  , watchDirs   , watchTree   , wrapWatch   , listDirectories   , watchDirectoryTree+  , FSEvent   ) where  import Control.Concurrent@@ -38,14 +40,14 @@  wrapWatch   :: (Reflex t, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m))-  => (FS.WatchManager -> FilePath -> FS.Action -> IO a)+  => (FS.WatchManager -> pathinfo -> FS.Action -> IO a)   -> FS.WatchConfig-  -> Event t FilePath+  -> Event t pathinfo   -> m (Event t FSEvent) wrapWatch f cfg path =   performEventAsync $ ffor path $ \p cb -> liftIO $ void $ forkIO $     FS.withManagerConf cfg $ \mgr -> do-      _ <- f mgr p cb -- FS.watchTree mgr p (const True) cb+      _ <- f mgr p cb       forever $ threadDelay 1000000  watchDir@@ -55,6 +57,15 @@   -> FS.ActionPredicate   -> m (Event t FSEvent) watchDir cfg path evFilter = wrapWatch (\mgr p -> FS.watchDir mgr p evFilter) cfg path++watchDirs+  :: (Reflex t, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m))+  => FS.WatchConfig+  -> Event t [FilePath]+  -> FS.ActionPredicate+  -> m (Event t FSEvent)+watchDirs cfg path evFilter = wrapWatch (\mgr ps cb -> forM_ ps $ \p ->+  FS.watchDir mgr p evFilter cb) cfg path  watchTree   :: (Reflex t, TriggerEvent t m, PerformEvent t m, MonadIO (Performable m))