@hackage hinotify0.2
Haskell binding to INotify
Categories
License
BSD-3-Clause
Maintainer
Lennart Kolmodin <kolmodin@gentoo.org>
Links
- Homepage
- Documentation
- No source repository
- Security
Versions
Installation
CustomDependencies (4)
Dependents (36)
@hackage/texbuilder, @hackage/watcher, @hackage/git-annex, @hackage/RollingDirectory, @hackage/filecache, @hackage/follow-file, Show all…
Package Flags
split-base
(on by default)
Choose the new smaller, split-up base package.
% hinotify: inotify for Haskell % Lennart Kolmodin kolmodin@gentoo.org % December 26, 2007
About
hinotify, a library to inotify which has been part of the Linux kernel since 2.6.13.
inotify provides file system event notification, simply add a watcher to a file or directory and get an event when it is accessed or modified.
This module is named inotify.
See example code in the examples directory, distributed with the source
code.
News
hinotify 0.2
: * Updates to the API
- Function names is now in semiCamelCase
- Restructure event parameters to make it more consistent
* Small test suit in tests/
* Compiles with GHC 6.8.2 and GHC 6.6.1
* Requires Cabal 1.2
hinotify 0.1 : Initial release
API
The API basically consists of:
initINotify :: IO INotify
addWatch :: INotify
-> [EventVariety] -- different events to listen on
-> FilePath -- file/directory to watch
-> (Event -> IO ()) -- event handler
-> IO WatchDescriptor
removeWatch :: INotify -> WatchDescriptor -> IO ()
A sample program:
import System.Directory
import System.IO
import System.INotify
main :: IO ()
main = do
inotify <- initINotify
print inotify
home <- getHomeDirectory
wd <- addWatch
inotify
[Open,Close,Access,Modify,Move]
home
print
print wd
putStrLn "Listens to your home directory. Hit enter to terminate."
getLine
removeWatch inotify wd
Download
The code is available via the homepage, and via darcs:
darcs get --partial http://haskell.org/~kolmodin/code/hinotify/
The API is available online.
I'm most grateful for feedback on the API, and what else you might have to suggest.
Author
Lennart Kolmodin
kolmodin at gentoo.org
Legal
This software is released under a BSD-style license. See LICENSE for more details.
Copyright © 2007 Lennart Kolmodin