Reputation: 75
I want to watch for changes in some files and do something on them when this happens
Upvotes: 0
Views: 322
Reputation: 66823
You don't mention what platform you want this to work on. Doing this in a nice way (without polling) has not been standardized across platforms (the way that reading and writing files has). So there's no simple platform-independent solution using just standard OCaml libraries.
There are individual mechanisms for particular platforms. By googling I found kqueue for BSD and macOS, inotify for Linux. If you happen to be on Linux, there are inotify wrappers in OPAM: https://opam.ocaml.org/packages/inotify/
Upvotes: 3