haskell-fswatch / hfsnotify

Unified Haskell interface for basic file system notifications
BSD 3-Clause "New" or "Revised" License
136 stars 40 forks source link

Document the new third argument to Event #83

Closed Profpatsch closed 3 years ago

Profpatsch commented 6 years ago

Each Event constructor has gained a third argument. For Added, Modified and Removed, that is a Bool indicating whether it is a file or a folder as far as I can see. The String in Unknown I have not yet looked up the meaning of.

I’d argue the API should be changed to be type-documenting, by using FileType = Directory | File instead of Bool (boolean blindness).

thomasjm commented 6 years ago

Sure, I'll add a line to the docs about the third argument when I get a minute. Changing the type would be a good idea next time we're making a breaking API change.

typesanitizer commented 6 years ago

I was quite confused when I read that, +1 to having it in the type. What are the semantics of Unknown supposed to be?

thomasjm commented 6 years ago

Unknown serves as an escape hatch for telling the client about events that the library doesn't understand/handle properly, rather than just dropping them on the floor as it has in the past.

Currently it can only be emitted by the Linux file watcher in response to some of the less common inotify events.

Once the library handles these events properly Unknown will hopefully be removed.

codygman commented 4 years ago

What is the Bool for?

Edit: Ah... just what I was looking for and about to create a bug for. Is it a directory, True or False.

Re-read again and saw:

I’d argue the API should be changed to be type-documenting, by using FileType = Directory | File instead of Bool (boolean blindness).
thomasjm commented 3 years ago

This is fixed in master branch and will be released in 0.4.0.0