fsnotify 0.1.0.1 → 0.1.0.2
raw patch · 5 files changed
+45/−26 lines, 5 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- CHANGELOG.md +8/−0
- fsnotify.cabal +2/−2
- src/System/FSNotify.hs +7/−0
- src/System/FSNotify/Devel.hs +27/−22
- test/test.hs +1/−2
CHANGELOG.md view
@@ -1,6 +1,14 @@ Changes ======= +Version 0.1.0.2+---------------++* Restore compatibility with GHC 7.4+* Fix a bug in `treeExtAny`, which previously work identically to+ `treeExtExists`+* Improve documentation+ Version 0.1.0.1 ---------------
fsnotify.cabal view
@@ -1,5 +1,5 @@ Name: fsnotify-Version: 0.1.0.1+Version: 0.1.0.2 Author: Mark Dittmer <mark.s.dittmer@gmail.com> Maintainer: Greg Weber <greg@gregweber.info>, Roman Cheplyaka <roma@ro-che.info> License: BSD3@@ -7,7 +7,7 @@ Synopsis: Cross platform library for file change notification. Description: Cross platform library for file creation, modification, and deletion notification. This library builds upon- existing libraries for platform-specific Window, Mac,+ existing libraries for platform-specific Windows, Mac, and Linux filesystem event notification. Category: Filesystem Cabal-Version: >= 1.8
src/System/FSNotify.hs view
@@ -213,3 +213,10 @@ -- thread is dead). How bad is that? The alternative is to kill the -- handler anyway when we're cancelling. forkFinally (action event) $ either (throwTo us) (const $ return ())++#if !MIN_VERSION_base(4,6,0)+forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId+forkFinally action and_then =+ mask $ \restore ->+ forkIO $ try (restore action) >>= and_then+#endif
src/System/FSNotify/Devel.hs view
@@ -1,18 +1,7 @@-module System.FSNotify.Devel- ( treeExtAny, treeExtExists,- doAllEvents,- allEvents, existsEvents- ) where--import Prelude hiding (FilePath)--import Data.Text-import Filesystem.Path.CurrentOS-import System.FSNotify--- import System.FSNotify.Path (fp)---- | Example of compiling scss files with compass+-- | Some additional functions on top of "System.FSNotify". --+-- Example of compiling scss files with compass+-- -- @ -- compass :: WatchManager -> FilePath -> IO () -- compass man dir = do@@ -24,10 +13,21 @@ -- return () -- @ --- | In the given directory tree,--- watch for any Added and Modified events (but ignore Removed events)--- for files with the given file extension--- perform the given action+module System.FSNotify.Devel+ ( treeExtAny, treeExtExists,+ doAllEvents,+ allEvents, existsEvents+ ) where++import Prelude hiding (FilePath)++import Data.Text+import Filesystem.Path.CurrentOS+import System.FSNotify++-- | In the given directory tree, watch for any 'Added' and 'Modified'+-- events (but ignore 'Removed' events) for files with the given file+-- extension treeExtExists :: WatchManager -> FilePath -- ^ Directory to watch -> Text -- ^ extension@@ -36,17 +36,18 @@ treeExtExists man dir ext action = watchTree man dir (existsEvents $ flip hasExtension ext) (doAllEvents action) --- | In the given directory tree,--- for files with the given file extension--- perform the given action+-- | In the given directory tree, watch for any events for files with the+-- given file extension treeExtAny :: WatchManager -> FilePath -- ^ Directory to watch -> Text -- ^ extension -> (FilePath -> IO ()) -- ^ action to run on file -> IO StopListening treeExtAny man dir ext action =- watchTree man dir (existsEvents $ flip hasExtension ext) (doAllEvents action)+ watchTree man dir (allEvents $ flip hasExtension ext) (doAllEvents action) +-- | Turn a 'FilePath' callback into an 'Event' callback that ignores the+-- 'Event' type and timestamp doAllEvents :: Monad m => (FilePath -> m ()) -> Event -> m () doAllEvents action event = case event of@@ -54,6 +55,8 @@ Modified f _ -> action f Removed f _ -> action f +-- | Turn a 'FilePath' predicate into an 'Event' predicate that accepts+-- only 'Added' and 'Modified' event types existsEvents :: (FilePath -> Bool) -> (Event -> Bool) existsEvents filt event = case event of@@ -61,6 +64,8 @@ Modified f _ -> filt f Removed _ _ -> False +-- | Turn a 'FilePath' predicate into an 'Event' predicate that accepts+-- any event types allEvents :: (FilePath -> Bool) -> (Event -> Bool) allEvents filt event = case event of
test/test.hs view
@@ -1,7 +1,6 @@ {-# LANGUAGE OverloadedStrings, ImplicitParams, ViewPatterns #-} import Prelude hiding- ( FilePath, writeFile, writeFile, removeFile- , createDirectory, removeDirectory)+ ( FilePath, writeFile, writeFile ) import Test.Tasty import Test.Tasty.HUnit import Filesystem