delta-0.2.1.2: A library for detecting file changes

Safe HaskellNone
LanguageHaskell2010

System.Delta.Callback

Contents

Synopsis

Documentation

data CallbackWatcher Source

Provides a callback based interface to an FRP base FileWatcher

data CallbackId Source

Id of a callback in a CallbackWatcher

Construction

withCallbacks :: FileWatcher -> IO CallbackWatcher Source

Wrap a file watcher in a datatype that allows adding callbacks

Adding callbacks

withDeleteCallback Source

Arguments

:: CallbackWatcher 
-> (FilePath -> IO ())

An IO action on the deleted path

-> IO CallbackId 

Add a callback that is executed when file deletion is detected

withChangedCallback Source

Arguments

:: CallbackWatcher 
-> (FilePath -> IO ())

Action on changed file

-> IO CallbackId 

Add a callback on a changed file

withNewCallback Source

Arguments

:: CallbackWatcher 
-> (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 :: CallbackWatcher -> CallbackId -> IO () Source

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

removeAllCallbacks :: CallbackWatcher -> IO () Source

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

Closing the watcher

closeCallbackWatcher :: CallbackWatcher -> IO () Source

Remove all callbacks and close the underlying FileWatcher

Helper functions

callbackOnEvent :: Event a -> (a -> IO ()) -> IO (IO ()) Source

Add a listener to an event, return the action to unregister the listener