diff options
author | Camil Staps | 2016-05-21 03:05:11 +0200 |
---|---|---|
committer | Camil Staps | 2016-05-21 03:05:11 +0200 |
commit | 5d66275fc1b119f6abe0c6efb538d34a7f0c606e (patch) | |
tree | c60ddb82b3e0c214a38bd7fad0cdc3a0a8be4dd6 /test.icl |
Initial commit
Diffstat (limited to 'test.icl')
-rw-r--r-- | test.icl | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test.icl b/test.icl new file mode 100644 index 0000000..bcb64a9 --- /dev/null +++ b/test.icl @@ -0,0 +1,31 @@ +module test + +import StdFile +import Data.Either +import Data.Maybe +import Inotify + +Start w +# (Just inot) = inotify_init 0 +# (Right watch, inot) + = inotify_add_watch (echo "file1") IN_ALL_EVENTS "file1" inot +# (Right watch, inot) + = inotify_add_watch (echo "file2") IN_ALL_EVENTS "file2" inot +# (io,w) = stdio w +# io = io <<< "Do something with file1 or file2\n" +# (ok,w) = fclose io w +# (inot, w) = loop inot w += inotify_close inot +where + loop :: !*(Inotify st) !*World -> *(*Inotify st, *World) + loop inot w + # inot = inotify_poll inot + # (inot, w) = inotify_check inot w + = loop inot w + + echo :: String INEvent Int *World -> *(Int, *World) + echo fname ev i w + # (io,w) = stdio w + # io = io <<< "EVENT: [" <<< fname <<< "; " <<< ev <<< "]\n" + # (ok,w) = fclose io w + = (i, w) |