diff options
author | Camil Staps | 2020-01-06 16:27:27 +0100 |
---|---|---|
committer | Camil Staps | 2020-01-06 16:27:27 +0100 |
commit | ba1b279a40c6b491ccd352bf22b888ae7dfbad97 (patch) | |
tree | af08dec7afefa240e94a3c0f7bd01d3aaa24acec /Inotify.dcl | |
parent | Cleanup example (diff) |
Expose Inotify type itself in callbacks to allow adding/removing watches
Diffstat (limited to 'Inotify.dcl')
-rw-r--r-- | Inotify.dcl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Inotify.dcl b/Inotify.dcl index e6893e2..611e616 100644 --- a/Inotify.dcl +++ b/Inotify.dcl @@ -8,11 +8,14 @@ from Data.Either import ::Either from Data.Maybe import ::Maybe /** - * An inotify file descriptor - * - * @var A state that is used for callbacks + * An inotify file descriptor. + * @var A state that can be used for application-specific information. */ -:: *Inotify st +:: *Inotify st = + { fd :: !Int + , watches :: ![(INWatch, INCallback st)] + , state :: !st + } //* An inotify watch descriptor :: INWatch @@ -28,7 +31,7 @@ from Data.Maybe import ::Maybe * * @var A state that is passed on. */ -:: INCallback st :== INEvent (Maybe String) st *World -> *(st, *World) +:: INCallback st :== INEvent (Maybe String) *(Inotify st) -> *(*World -> *(*Inotify st, *World)) //* Bitwise OR for event masks (|-) infixl 6 :: (INMask INMask -> INMask) |