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

Modulehedgehog-1.7Haskell2010

Hedgehog.Internal.Shrink

  • 6 values
  • Packagehedgehog-1.7
  • Exports6
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceShrink.hs
valuetowards :: Integral a => a -> a -> [a]
#

Shrink an integral number by edging towards a destination.

Example1 expression
towards 0 100[0,50,75,88,94,97,99]
Example1 expression
towards 500 1000[500,750,875,938,969,985,993,997,999]
Example1 expression
towards (-50) (-26)[-50,-38,-32,-29,-27]

Note we always try the destination first, as that is the optimal shrink.

valuetowardsFloat :: RealFloat a => a -> a -> [a]
#

Shrink a floating-point number by edging towards a destination.

Example1 expression
take 7 (towardsFloat 0.0 100)[0.0,50.0,75.0,87.5,93.75,96.875,98.4375]
Example1 expression
take 7 (towardsFloat 1.0 0.5)[1.0,0.75,0.625,0.5625,0.53125,0.515625,0.5078125]

Note we always try the destination first, as that is the optimal shrink.

valuelist :: [a] -> [[a]]
#

Shrink a list by edging towards the empty list.

Example1 expression
list [1,2,3][[],[2,3],[1,3],[1,2]]
Example1 expression
list "abcd"["","cd","ab","bcd","acd","abd","abc"]

Note we always try the empty list first, as that is the optimal shrink.

valuehalves :: Integral a => a -> [a]
#

Produce a list containing the progressive halving of an integral.

Example1 expression
halves 15[15,7,3,1]
Example1 expression
halves 100[100,50,25,12,6,3,1]
Example1 expression
halves (-26)[-26,-13,-6,-3,-1]
valueremoves :: Int -> [a] -> [[a]]
#

Produce all permutations of removing k elements from a list.

Example1 expression
removes 2 "abcdef"["cdef","abef","abcd"]
valueconsNub :: Eq a => a -> [a] -> [a]
#

Cons an element on to the front of a list unless it is already there.