Skip to content

Fix warnings revealed by v0.14.1 PS release; export functions #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ Notable changes to this project are documented in this file. The format is based
Breaking changes:

New features:
- Export `enum` and `randomSampleOne` (#125 by @JordanMartinez)

Bugfixes:

Other improvements:
- Fix warning revealed by v0.14.1 PS release (#125 by @JordanMartinez)

## [v7.0.0](https://github.com/purescript/purescript-quickcheck/releases/tag/v7.0.0) - 2021-02-26

Expand Down
4 changes: 3 additions & 1 deletion src/Test/QuickCheck/Gen.purs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ module Test.QuickCheck.Gen
, frequency
, arrayOf
, arrayOf1
, enum
, listOf
, vectorOf
, elements
Expand All @@ -28,6 +29,7 @@ module Test.QuickCheck.Gen
, sample
, randomSample
, randomSample'
, randomSampleOne
) where

import Prelude
Expand Down Expand Up @@ -164,7 +166,7 @@ frequency :: forall a. NonEmptyList (Tuple Number (Gen a)) -> Gen a
frequency = NEL.uncons >>> \{ head: x, tail: xs } -> let
xxs = Cons x xs
total = unwrap $ fold (map (Additive <<< fst) xxs :: List (Additive Number))
pick n d Nil = d
pick _ d Nil = d
pick n d (Cons (Tuple k x') xs') = if n <= k then x' else pick (n - k) d xs'
in do
n <- choose zero total
Expand Down