Closed dmbarbour closed 11 years ago
Of course, even easier would be:
data Session = Session
{ killSession :: IO ()
, killWatch :: FilePath -> IO ()
, initWatch :: FilePath -> (Event -> IO ()) -> IO ()
}
With an explicit assertion that there is only one active watch per FilePath per Session. No fancy types required.
I like this option because Linux's inotify doesn't support more than one action per inotify 'session' anyway. If we want FSNotify to be portable (which is the point, right?) then we'll need to accommodate the lowest common denominator.
I find the repeated 'either nativeImpl pollingImpl' code in System.FSNotify a little irritating. Fortunately, it would be easy to eliminate, e.g. by shifting away from a typeful model to something closer to:
Then using Rank2Types to hide wd.
Potentially, we can also eliminate listenRecursive since I'm working on a new Event type that carries isDir information. We'd need to make the Session type independent of channels. But we can simplify it to:
And then introduce channels and Debounce externally.
None of this would be observable to a client of FSNotify.