HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduleauto-update-0.2.6Haskell2010

Control.Debounce.Internal

Unstable API which exposes internals for testing.

  • 2 types
  • 5 values
datadata DebounceSettings
#

Settings to control how debouncing should work.

This should be constructed using defaultDebounceSettings and record update syntax, e.g.:

let settings = defaultDebounceSettings { debounceAction = flushLog }

Constructors

datadata DebounceEdge
#

Setting to control whether the action happens at the leading and/or trailing edge of the timeout.

Constructors

  • Leading

    Perform the action immediately, and then begin a cooldown period. If the trigger happens again during the cooldown, wait until the end of the cooldown and then perform the action again, then enter a new cooldown period.

  • LeadingMute

    Perform the action immediately, and then begin a cooldown period. If the trigger happens again during the cooldown, it is ignored.

  • Trailing

    Start a cooldown period and perform the action when the period ends. If another trigger happens during the cooldown, it has no effect.

  • TrailingDelay

    Start a cooldown period and perform the action when the period ends. If another trigger happens during the cooldown, it restarts the cooldown again.

Instances2Eq, Show

Perform the action immediately, and then begin a cooldown period. If the trigger happens again during the cooldown, wait until the end of the cooldown and then perform the action again, then enter a new cooldown period.

Example of how this style debounce works:

! = function execution
. = cooldown period
X = debounced code execution

!   !         !            !
 ....... ....... .......    .......
X       X       X          X

Perform the action immediately, and then begin a cooldown period. If the trigger happens again during the cooldown, it is ignored.

Example of how this style debounce works:

! = function execution
. = cooldown period
X = debounced code execution

!   !      !     !
 .......    .......
X          X

Start a cooldown period and perform the action when the period ends. If another trigger happens during the cooldown, it has no effect.

Example of how this style debounce works:

! = function execution
. = cooldown period
X = debounced code execution

!     !     !  !
 .......     .......
        X           X

Start a cooldown period and perform the action when the period ends. If another trigger happens during the cooldown, it restarts the cooldown again.

N.B. If a trigger happens DURING the debounceAction it starts a new cooldown. So if the debounceAction takes longer than the debounceFreq, it might run again before the previous action has ended.

Example of how this style debounce works:

! = function execution
. = cooldown period
X = debounced code execution

!           !  !    !
 .......     ...............
        X                   X