/usr/share/doc/libghc-fsnotify-doc/html/fsnotify.txt is in libghc-fsnotify-doc 0.2.1.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | -- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Cross platform library for file change notification.
--
-- Cross platform library for file creation, modification, and deletion
-- notification. This library builds upon existing libraries for
-- platform-specific Windows, Mac, and Linux filesystem event
-- notification.
@package fsnotify
@version 0.2.1.1
-- | NOTE: This library does not currently report changes made to
-- directories, only files within watched directories.
--
-- Minimal example:
--
-- <pre>
-- {-# LANGUAGE OverloadedStrings #-} -- for FilePath literals
--
-- import System.FSNotify
-- import Control.Concurrent (threadDelay)
-- import Control.Monad (forever)
--
-- main =
-- withManager $ \mgr -> do
-- -- start a watching job (in the background)
-- watchDir
-- mgr -- manager
-- "." -- directory to watch
-- (const True) -- predicate
-- print -- action
--
-- -- sleep forever (until interrupted)
-- forever $ threadDelay 1000000
-- </pre>
module System.FSNotify
-- | 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 Event
Added :: FilePath -> UTCTime -> Event
Modified :: FilePath -> UTCTime -> Event
Removed :: FilePath -> UTCTime -> Event
type EventChannel = Chan Event
-- | Helper for extracting the time associated with an event.
eventTime :: Event -> UTCTime
-- | Helper for extracting the path associated with an event.
eventPath :: Event -> FilePath
-- | An action to be performed in response to an event.
type Action = Event -> IO ()
-- | A predicate used to determine whether to act on an event.
type ActionPredicate = Event -> Bool
-- | Watch manager. You need one in order to create watching jobs.
data WatchManager
-- | Perform an IO action with a WatchManager in place. Tear down the
-- WatchManager after the action is complete.
withManager :: (WatchManager -> IO a) -> IO a
-- | Start a file watch manager. Directories can only be watched when they
-- are managed by a started watch watch manager. When finished watching.
-- you must release resources via <a>stopManager</a>. It is preferrable
-- if possible to use <a>withManager</a> to handle this automatically.
startManager :: IO WatchManager
-- | Stop a file watch manager. Stopping a watch manager will immediately
-- stop watching for files and free resources.
stopManager :: WatchManager -> IO ()
-- | Default configuration
--
-- <ul>
-- <li>Debouncing is enabled with a time interval of 1 millisecond</li>
-- <li>Polling is disabled</li>
-- <li>The polling interval defaults to 1 second</li>
-- </ul>
defaultConfig :: WatchConfig
-- | Watch configuration
data WatchConfig
WatchConfig :: Debounce -> Int -> Bool -> WatchConfig
-- | Debounce configuration
[confDebounce] :: WatchConfig -> Debounce
-- | Polling interval if polling is used (microseconds)
[confPollInterval] :: WatchConfig -> Int
-- | Force use of polling, even if a more effective method may be
-- available. This is mostly for testing purposes.
[confUsePolling] :: WatchConfig -> Bool
-- | 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 <a>Event</a> notification are both non-essential and
-- idempotent.
data Debounce
-- | perform debouncing based on the default time interval of 1 millisecond
DebounceDefault :: Debounce
-- | perform debouncing based on the specified time interval
Debounce :: NominalDiffTime -> Debounce
-- | do not perform debouncing
NoDebounce :: Debounce
-- | Like <a>withManager</a>, but configurable
withManagerConf :: WatchConfig -> (WatchManager -> IO a) -> IO a
-- | Like <a>startManager</a>, but configurable
startManagerConf :: WatchConfig -> IO WatchManager
-- | An action that cancels a watching/listening job
type StopListening = IO ()
-- | Does this manager use polling?
isPollingManager :: WatchManager -> Bool
-- | Watch the immediate contents of a directory by committing an Action
-- for each event. Watching the immediate contents of a directory will
-- only report events associated with files within the specified
-- directory, and not files within its subdirectories. No two events
-- pertaining to the same FilePath will be executed concurrently.
watchDir :: WatchManager -> FilePath -> ActionPredicate -> Action -> IO StopListening
-- | Watch the immediate contents of a directory by streaming events to a
-- Chan. Watching the immediate contents of a directory will only report
-- events associated with files within the specified directory, and not
-- files within its subdirectories.
watchDirChan :: WatchManager -> FilePath -> ActionPredicate -> EventChannel -> IO StopListening
-- | Watch all the contents of a directory by committing an Action for each
-- event. Watching all the contents of a directory will report events
-- associated with files within the specified directory and its
-- subdirectories. No two events pertaining to the same FilePath will be
-- executed concurrently.
watchTree :: WatchManager -> FilePath -> ActionPredicate -> Action -> IO StopListening
-- | Watch all the contents of a directory by streaming events to a Chan.
-- Watching all the contents of a directory will report events associated
-- with files within the specified directory and its subdirectories.
watchTreeChan :: WatchManager -> FilePath -> ActionPredicate -> EventChannel -> IO StopListening
-- | Some additional functions on top of <a>System.FSNotify</a>.
--
-- Example of compiling scss files with compass
--
-- <pre>
-- compass :: WatchManager -> FilePath -> IO ()
-- compass man dir = do
-- putStrLn $ "compass " ++ encodeString dir
-- treeExtExists man dir "scss" $ fp ->
-- when ("deploy" <a>notElem</a> splitDirectories fp) $ do
-- let d = encodeString $ head (splitDirectories rel)
-- system "cd " ++ d ++ "&& bundle exec compass compile"
-- return ()
-- </pre>
module System.FSNotify.Devel
-- | In the given directory tree, watch for any events for files with the
-- given file extension
treeExtAny :: WatchManager -> FilePath -> Text -> (FilePath -> IO ()) -> IO StopListening
-- | In the given directory tree, watch for any <a>Added</a> and
-- <a>Modified</a> events (but ignore <a>Removed</a> events) for files
-- with the given file extension
treeExtExists :: WatchManager -> FilePath -> Text -> (FilePath -> IO ()) -> IO StopListening
-- | Turn a <a>FilePath</a> callback into an <a>Event</a> callback that
-- ignores the <a>Event</a> type and timestamp
doAllEvents :: Monad m => (FilePath -> m ()) -> Event -> m ()
-- | Turn a <a>FilePath</a> predicate into an <a>Event</a> predicate that
-- accepts any event types
allEvents :: (FilePath -> Bool) -> (Event -> Bool)
-- | Turn a <a>FilePath</a> predicate into an <a>Event</a> predicate that
-- accepts only <a>Added</a> and <a>Modified</a> event types
existsEvents :: (FilePath -> Bool) -> (Event -> Bool)
|