fsnotify-conduit-0.1.1.1: Get filesystem notifications as a stream of events

Safe HaskellNone
LanguageHaskell2010

Data.Conduit.FSNotify

Contents

Synopsis

Conduit API

sourceFileChanges :: MonadResource m => FileChangeSettings -> ConduitM i Event m () Source #

Watch for changes to a directory, and yield the file paths downstream. Typical usage would be:

sourceFileChanges (setRelative False $ mkFileChangeSettings dir)

Since: 0.1.0.0

acquireSourceFileChanges :: MonadIO m => FileChangeSettings -> Acquire (ConduitM i Event m ()) Source #

The same as sourceFileChanges, but returned in an Acquire. This is slightly clunkier to use than sourceFileChanges, but provides two benefits:

  • It does not require MonadResource
  • You are guaranteed that the directory will be watched immediately. With sourceFileChanges, watching will only commence once you await for the first change.

Since: 0.1.1.0

data FileChangeSettings Source #

Settings for watching for file changes, to be passed in to sourceFileChanges. Should be created with mkFileChangeSettings.

Since: 0.1.0.0

mkFileChangeSettings Source #

Arguments

:: FilePath

directory to watch

-> FileChangeSettings 

Create a FileChangeSettings from a directory to watch. Provides defaults which can be overridden by the setter functions in this module, such as setRelative.

Since: 0.1.0.0

Setters

setWatchConfig :: WatchConfig -> FileChangeSettings -> FileChangeSettings Source #

Override the WatchConfig when creating the WatchManager.

Default: defaultConfig

Since: 0.1.0.0

setRelative :: Bool -> FileChangeSettings -> FileChangeSettings Source #

Whether to provide paths relative to the root directory (True) or absolute paths (False).

Default: True (relative paths)

Since: 0.1.0.0

setRecursive :: Bool -> FileChangeSettings -> FileChangeSettings Source #

Recursively watch a directory tree?

Default: True

Since: 0.1.0.0

setPredicate :: (Event -> Bool) -> FileChangeSettings -> FileChangeSettings Source #

Predicate used to filter events.

Default: const True (allow all events)

Since: 0.1.0.0

Re-exports

data Event :: * #

A file event reported by a file watcher. Each event contains the canonical path for the file and a timestamp guaranteed to be after the event occurred (timestamps represent current time when FSEvents receives it from the OS and/or platform-specific Haskell modules).

Instances

Eq Event 

Methods

(==) :: Event -> Event -> Bool #

(/=) :: Event -> Event -> Bool #

Show Event 

Methods

showsPrec :: Int -> Event -> ShowS #

show :: Event -> String #

showList :: [Event] -> ShowS #

eventTime :: Event -> UTCTime #

Helper for extracting the time associated with an event.

eventPath :: Event -> FilePath #

Helper for extracting the path associated with an event.

data WatchConfig :: * #

Watch configuration

Constructors

WatchConfig 

Fields

data Debounce :: * #

This specifies whether multiple events from the same file should be collapsed together, and how close is close enough.

This is performed by ignoring any event that occurs to the same file until the specified time interval has elapsed.

Note that the current debouncing logic may fail to report certain changes to a file, potentially leaving your program in a state that is not consistent with the filesystem.

Make sure that if you are using this feature, all changes you make as a result of an Event notification are both non-essential and idempotent.

Constructors

DebounceDefault

perform debouncing based on the default time interval of 1 millisecond

Debounce NominalDiffTime

perform debouncing based on the specified time interval

NoDebounce

do not perform debouncing