delta-0.1.2.0: A library for detecting file changes

Safe HaskellNone
LanguageHaskell2010

System.Delta.Callback

Contents

Synopsis

Documentation

data CallbackWatcher w

Provides a callback based interface to an FRP base FileWatcher

data CallbackId

Id of a callback in a CallbackWatcher

Construction

withCallbacks :: FileWatcher a => a -> IO (CallbackWatcher a)

Wrap a file watcher in a datatype that allows adding callbacks

Adding callbacks

withDeleteCallback

Arguments

:: FileWatcher a 
=> CallbackWatcher a 
-> (FilePath -> IO ())

An IO action on the deleted path

-> IO CallbackId 

Add a callback that is executed when file deletion is detected

withChangedCallback

Arguments

:: FileWatcher a 
=> CallbackWatcher a 
-> (FileInfo -> IO ())

Action on changed file

-> IO CallbackId 

Add a callback on a changed file

withNewCallback

Arguments

:: FileWatcher a 
=> CallbackWatcher a 
-> (FilePath -> IO ())

An IO action on the new path

-> IO CallbackId 

Add a callback that is executed when file creation is detected

Removing callbacks

unregisterCallback :: FileWatcher a => CallbackWatcher a -> CallbackId -> IO ()

Unregister the given CallbackId from the FileWatcher does nothing if the CallbackId is not in the watcher

removeAllCallbacks :: FileWatcher a => CallbackWatcher a -> IO ()

Remove all callbacks form the watcher. They will not be called after this

Closing the watcher

closeCallbackWatcher :: FileWatcher a => CallbackWatcher a -> IO ()

Remove all callbacks and close the underlying FileWatcher