Safe Haskell | None |
---|---|
Language | Haskell2010 |
- sourceFileChanges :: MonadResource m => FileChangeSettings -> ConduitM i Event m ()
- acquireSourceFileChanges :: MonadIO m => FileChangeSettings -> Acquire (ConduitM i Event m ())
- data FileChangeSettings
- mkFileChangeSettings :: FilePath -> FileChangeSettings
- setWatchConfig :: WatchConfig -> FileChangeSettings -> FileChangeSettings
- setRelative :: Bool -> FileChangeSettings -> FileChangeSettings
- setRecursive :: Bool -> FileChangeSettings -> FileChangeSettings
- setPredicate :: (Event -> Bool) -> FileChangeSettings -> FileChangeSettings
- data Event :: *
- eventTime :: Event -> UTCTime
- eventPath :: Event -> FilePath
- data WatchConfig :: * = WatchConfig {}
- data Debounce :: *
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 youawait
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
:: 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
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
setPredicate :: (Event -> Bool) -> FileChangeSettings -> FileChangeSettings Source #
Predicate used to filter events.
Default: const True
(allow all events)
Since: 0.1.0.0
Re-exports
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).
data WatchConfig :: * #
Watch configuration
WatchConfig | |
|
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.
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 |