[Add README and makefile to build the .html Lennart Kolmodin **20071223172943] { addfile ./Makefile hunk ./Makefile 1 + +.PHONY : docs + +docs : README.html + +%.html : % + pandoc -s -S --toc -c hinotify.css $< -o $@ addfile ./README hunk ./README 1 +% hinotify: inotify for Haskell +% Lennart Kolmodin +% December 22, 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. + +[inotify]: http://www.kernel.org/pub/linux/kernel/people/rml/inotify/ + +API +--- + +The API basically consists of: + + init :: 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 Prelude hiding (init) + import System.INotify + + main :: IO () + main = do + inotify <- init + 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 + +[homepage]: http://haskell.org/~kolmodin/code/hinotify/ + +[API]: http://haskell.org/~kolmodin/code/hinotify/docs/api/ addfile ./README.html hunk ./README.html 1 + +hinotify: inotify for Haskell +

hinotify: inotify for Haskell

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.

API

The API basically consists of:

init :: 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 Prelude hiding (init)
+import System.INotify
+
+main :: IO ()
+main = do
+    inotify <- init
+    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

This software is released under a BSD-style license. See LICENSE for more details.

Copyright © 2007 Lennart Kolmodin

+ }