diff options
author | Camil Staps | 2016-05-21 10:48:26 +0200 |
---|---|---|
committer | Camil Staps | 2016-05-21 10:48:26 +0200 |
commit | f2edfd5037e6dd4fa10e00b64cbd62f6cc50daa1 (patch) | |
tree | b99defa2382d269cd502bafaa3c05dd265e01a7e /test.icl | |
parent | 80 chars (diff) |
Also pass event->name through; inotify_loop_forever
Diffstat (limited to 'test.icl')
-rw-r--r-- | test.icl | 29 |
1 files changed, 14 insertions, 15 deletions
@@ -11,21 +11,20 @@ Start w = 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 +# (io,w) = stdio w +# io = io <<< "Do something with file1 or file2\n" +# (ok,w) = fclose io w +# (inot, w) = inotify_loop_forever 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 + echo :: String INEvent (Maybe String) Int *World -> *(Int, *World) + echo fname ev f i w + # (io,w) = stdio w + # io = io <<< "EVENT: ["<<< fname <<<"; "<<< ev <<<"; "<<< f <<<"]\n" + # (ok,w) = fclose io w = (i, w) + +instance <<< (Maybe a) | <<< a +where + (<<<) f Nothing = f + (<<<) f (Just x) = f <<< x |