Safe Haskell | Safe |
---|---|

Language | Haskell98 |

# Documentation

towards :: Integral a => a -> a -> [a] Source #

Shrink an integral number by edging towards a destination.

`>>>`

[0,50,75,88,94,97,99]`towards 0 100`

`>>>`

[500,750,875,938,969,985,993,997,999]`towards 500 1000`

`>>>`

[-50,-38,-32,-29,-27]`towards (-50) (-26)`

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

towardsFloat :: RealFloat a => a -> a -> [a] Source #

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

`>>>`

[0.0,50.0,75.0,87.5,93.75,96.875,98.4375]`take 7 (towardsFloat 0.0 100)`

`>>>`

[1.0,0.75,0.625,0.5625,0.53125,0.515625,0.5078125]`take 7 (towardsFloat 1.0 0.5)`

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

Shrink a list by edging towards the empty list.

`>>>`

[[],[2,3],[1,3],[1,2]]`list [1,2,3]`

`>>>`

["","cd","ab","bcd","acd","abd","abc"]`list "abcd"`

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

halves :: Integral a => a -> [a] Source #

Produce a list containing the progressive halving of an integral.

`>>>`

[15,7,3,1]`halves 15`

`>>>`

[100,50,25,12,6,3,1]`halves 100`

`>>>`

[-26,-13,-6,-3,-1]`halves (-26)`