haskell-fswatch / hfsnotify

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

Allow debouncing regardless of if event is same file #90

Closed codygman closed 3 years ago

codygman commented 4 years ago

I have a use case where I just want to debounce for a time interval and not care about if it's the same file.

Say I modify a.hs, b.hs, and c.hs in my editor. Then I save them all at once. The action that I have specified will be run 3 times.

codygman commented 4 years ago

We probably want to add a CustomDebounce (Event -> Bool) case to the Debounce sum type.

What confuses me though, is searching for function debounce I can't actually find where it's used.

thomasjm commented 4 years ago

Hi @codygman, sorry for the delay. It's actually an explicit goal of this library at the moment to decouple and remove debouncing support. Debouncing is really orthogonal to file watching, so it's not this library's place to do it, even though historically it has.

It's recommended to disable debouncing on this library and do your own debouncing in your event handler.

codygman commented 4 years ago

Debouncing is really orthogonal to file watching

Can you expand on this? How is it orthogonal in your opinion?

thomasjm commented 4 years ago

I simply mean a library should do one thing and do it well. This is a library for watching files and firing events when they change. Debouncing is a separate concern that can be managed independently (with your own custom code, or with another library like Control.Debounce).

thomasjm commented 3 years ago

Tidying up old issues, going to close this one as wontfix.