packages feed

less-arbitrary 0.1.2.0 → 0.1.3.0

raw patch · 3 files changed

+13/−2 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,5 +1,7 @@ # Revision history for less-arbitrary +0.1.3.0 -- 2020-12-14+* Added `suchThat`.  0.1.2.0 -- 2020-12-13 * Exposed `Test.LessArbitrary.Cost` module.
less-arbitrary.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: dd5540dd675e80ceab8bd98fe62c04c526f71fc96ebd88be2853fa32d496dea2+-- hash: 4ea65eec84a09bbf7d6249aa61d255e145ccba99f5e263d6bdc399a966156b71  name:           less-arbitrary-version:        0.1.2.0+version:        0.1.3.0 synopsis:       Linear time testing with variant of Arbitrary class that always terminates. description:    Ever found non-terminating Arbitrary instance?                 Ever wondered what would be a runtime cost of particular Arbitrary instance?
src/Test/LessArbitrary.hs view
@@ -330,6 +330,15 @@ budgetChoose  = do   Cost b <- currentBudget   CostGen $ lift $ QC.choose (1, b)++-- | Version of `suchThat` using budget instead of sized generators.+cg `suchThat` pred = do+  result <- cg+  if pred result+     then return result+     else do+       spend 1+       cg `suchThat` pred -- ~\~ end -- ~\~ begin <<less-arbitrary.md|lifting-arbitrary>>[2] frequency :: [(Int, CostGen a)] -> CostGen a