Instances1Show
Show (RollingHash a)Defined in data-hash-0.2.0.1 · Data.Hash.Rolling
:: a typeCtrl KGHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27
Moduledata-hash-0.2.0.1Haskell98
Efficient implementation of a rolling hash, i.e., the computation of a hash through
a moving window of a fixed size n over some stream. All operations are O(1) (in
particular, they do not depend on the size of the window).
Some laws that this type satisfies:
currentHash rh == foldl1 combine (lastHashes rh)length (lastHashes rh) <= windowSize rhlength (lastHashes $ addAndRoll rh a) == windowSize rh -- whenever length (lastHashes rh) == windowSize rhlast (lastHashes $ addAndRoll rh x) == hash ainit (lastHashes $ addAndRoll rh a) isSuffixOf (lastHashes rh)RollingHash typeShow (RollingHash a)Defined in data-hash-0.2.0.1 · Data.Hash.RollingrollingHash n creates a RollingHash of window
size n (for n > 0)
addAndRoll x rh adds a new input element and rolls the window
one place through the input (if at least n elements were
already consumed).
lastHashes rh returns the last n hashes.