File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,15 +21,15 @@ main = quickCheck \n -> n + 1 > n
2121#### ` QC `
2222
2323``` purescript
24- type QC a = forall eff. Eff (console :: CONSOLE, random :: RANDOM, err :: EXCEPTION | eff) a
24+ type QC eff a = Eff (console :: CONSOLE, random :: RANDOM, err :: EXCEPTION | eff) a
2525```
2626
2727A type synonym which represents the effects used by the ` quickCheck ` function.
2828
2929#### ` quickCheck `
3030
3131``` purescript
32- quickCheck :: forall prop. (Testable prop) => prop -> QC Unit
32+ quickCheck :: forall eff prop. (Testable prop) => prop -> QC eff Unit
3333```
3434
3535Test a property.
@@ -40,7 +40,7 @@ prints the test results to the console.
4040#### ` quickCheck' `
4141
4242``` purescript
43- quickCheck' :: forall prop. (Testable prop) => Int -> prop -> QC Unit
43+ quickCheck' :: forall eff prop. (Testable prop) => Int -> prop -> QC eff Unit
4444```
4545
4646A variant of the ` quickCheck ` function which accepts an extra parameter
Original file line number Diff line number Diff line change @@ -102,7 +102,8 @@ with uniform probability.
102102chooseInt :: Int -> Int -> Gen Int
103103```
104104
105- Create a random generator which chooses an integer from a range.
105+ Create a random generator which chooses uniformly distributed
106+ integers from the closed interval ` [a, b] ` .
106107
107108#### ` oneOf `
108109
Original file line number Diff line number Diff line change @@ -83,14 +83,15 @@ choose a b = (*) (max - min) >>> (+) min <$> uniform where
8383 min = M .min a b
8484 max = M .max a b
8585
86- -- | Create a random generator which chooses an integer from a range.
86+ -- | Create a random generator which chooses uniformly distributed
87+ -- | integers from the closed interval `[a, b]`.
8788chooseInt :: Int -> Int -> Gen Int
8889chooseInt a b = clamp <$> lcgStep
8990 where
9091 clamp :: Int -> Int
91- clamp x = case x `mod` (b - a) of
92+ clamp x = case x `mod` (b - a + one ) of
9293 r | r >= 0 -> a + r
93- | otherwise -> b + r
94+ | otherwise -> b + r + one
9495
9596-- | Create a random generator which selects and executes a random generator from
9697-- | a non-empty collection of random generators with uniform probability.
You can’t perform that action at this time.
0 commit comments