• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

kolmodin/hinotify: Haskell binding to inotify

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

kolmodin/hinotify

开源软件地址(OpenSource Url):

https://github.com/kolmodin/hinotify

开源编程语言(OpenSource Language):

Haskell 93.5%

开源软件介绍(OpenSource Introduction):

hinotify: inotify for Haskell

Build Status

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 hinotify.

See example code in the examples directory, distributed with the source code.

News

hinotify 0.3.7

  • Bug fix: When registerering a new watch on a path which is already watched, don't overwrite the event listener from the previous watch.

hinotify 0.3.2

  • Make each WatchDescriptor contain its INotify. Changes to the function types:
 -removeWatch :: INotify -> WatchDescriptor -> IO ()
 +removeWatch :: WatchDescriptor -> IO ()
  • Fix typo in declaration of Deleted in data Event;
 - { isDirecotry :: Bool
 + { isDirectory :: Bool

hinotify 0.3.1

  • Use inotify.h from glibc rather than from the linux headers, as recommended upstream.

hinotify 0.3

  • Compiles with GHC 6.12, GHC 6.10.4, GHC 6.8.2 and GHC 6.6.1

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 :: 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 wd

Download

The code is available via the homepage, and via darcs:

git clone https://github.com/kolmodin/hinotify.git

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 gmail.com

Legal

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

Copyright © 2007-2012 Lennart Kolmodin




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
VerbalExpressions/HaskellVerbalExpressions发布时间:2022-06-24
下一篇:
iu-parfunc/lvars: The LVish Haskell library发布时间:2022-06-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap