System.FSNotify.Devel

fsnotify-0.4.1.0: Cross platform library for file change notification.

Safe Haskell | None
Language | Haskell2010

System.FSNotify.Devel

Description

Some additional functions on top of System.FSNotify.

Example of compiling scss files with compass

    compass :: WatchManager -> FilePath -> m ()
    compass man dir = do
     putStrLn $ "compass " ++ encodeString dir
     treeExtExists man dir "scss" $ fp ->
       when ("deploy" notElem splitDirectories fp) $ do
        let d = encodeString $ head (splitDirectories rel)
        system "cd " ++ d ++ "&& bundle exec compass compile"
     return ()

Synopsis

- treeExtAny :: WatchManager -> FilePath -> Text -> (FilePath -> IO ()) -> IO StopListening
- treeExtExists :: WatchManager -> FilePath -> Text -> (FilePath -> IO ()) -> IO StopListening
- doAllEvents :: Monad m => (FilePath -> m ()) -> Event -> m ()
- allEvents :: (FilePath -> Bool) -> Event -> Bool
- existsEvents :: (FilePath -> Bool) -> Event -> Bool

# Documentation

treeExtAny #

Arguments

:: WatchManager |
-> FilePath | Directory to watch
-> Text | extension
-> (FilePath -> IO ()) | action to run on file
-> IO StopListening |

In the given directory tree, watch for any events for files with the given file extension

treeExtExists #

Arguments

:: WatchManager |
-> FilePath | Directory to watch
-> Text | extension
-> (FilePath -> IO ()) | action to run on file
-> IO StopListening |

In the given directory tree, watch for any `Added` and `Modified` events (but ignore `Removed` events) for files with the given file extension

doAllEvents :: Monad m => (FilePath -> m ()) -> Event -> m () #

Turn a `FilePath` callback into an `Event` callback that ignores the `Event` type and timestamp

allEvents :: (FilePath -> Bool) -> Event -> Bool #

Turn a `FilePath` predicate into an `Event` predicate that accepts any event types

existsEvents :: (FilePath -> Bool) -> Event -> Bool #

Turn a `FilePath` predicate into an `Event` predicate that accepts only `Added`, `Modified`, and `ModifiedAttributes` event types