ghcide-2.9.0.0: The core of an IDE
Safe HaskellSafe-Inferred
LanguageGHC2021

Development.IDE.Core.Debouncer

Synopsis

Documentation

data Debouncer k Source #

A debouncer can be used to avoid triggering many events (e.g. diagnostics) for the same key (e.g. the same file) within a short timeframe. This is accomplished by delaying each event for a given time. If another event is registered for the same key within that timeframe, only the new event will fire.

We abstract over the debouncer used so we an use a proper debouncer in the IDE but disable debouncing in the DAML CLI compiler.

registerEvent :: Debouncer k -> Seconds -> k -> IO () -> IO () Source #

newAsyncDebouncer :: (Eq k, Hashable k) => IO (Debouncer k) Source #

Debouncer used in the IDE that delays events as expected.

noopDebouncer :: Debouncer k Source #

Debouncer used in the DAML CLI compiler that emits events immediately.