Skip to content

Commit ecd8ceb

Browse files
konsumlammandrewthad
authored andcommitted
Use Positive for stimes laws
This avoids having to discard half the test cases
1 parent 6713b48 commit ecd8ceb

File tree

1 file changed

+8
-8
lines changed
  • quickcheck-classes-base/src/Test/QuickCheck/Classes

1 file changed

+8
-8
lines changed

quickcheck-classes-base/src/Test/QuickCheck/Classes/Semigroup.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,20 @@ semigroupConcatenation _ = myForAllShrink True (const True)
110110
(\(a, SmallList as) -> foldr1 (<>) (a :| as))
111111

112112
semigroupTimes :: forall a. (Semigroup a, Eq a, Arbitrary a, Show a) => Proxy a -> Property
113-
semigroupTimes _ = myForAllShrink True (\(_,n) -> n > 0)
114-
(\(a :: a, n :: Int) -> ["a = " ++ show a, "n = " ++ show n])
113+
semigroupTimes _ = myForAllShrink True (const True)
114+
(\(a :: a, Positive (n :: Int)) -> ["a = " ++ show a, "n = " ++ show n])
115115
"stimes n a"
116-
(\(a,n) -> stimes n a)
116+
(\(a, Positive n) -> stimes n a)
117117
"foldr1 (<>) (replicate n a)"
118-
(\(a,n) -> foldr1 (<>) (replicate n a))
118+
(\(a, Positive n) -> foldr1 (<>) (replicate n a))
119119

120120
semigroupExponential :: forall a. (Semigroup a, Eq a, Arbitrary a, Show a) => Proxy a -> Property
121-
semigroupExponential _ = myForAllShrink True (\(_,_,n) -> n > 0)
122-
(\(a :: a, b, n :: Int) -> ["a = " ++ show a, "b = " ++ show b, "n = " ++ show n])
121+
semigroupExponential _ = myForAllShrink True (const True)
122+
(\(a :: a, b, Positive (n :: Int)) -> ["a = " ++ show a, "b = " ++ show b, "n = " ++ show n])
123123
"stimes n (a <> b)"
124-
(\(a,b,n) -> stimes n (a <> b))
124+
(\(a, b, Positive n) -> stimes n (a <> b))
125125
"stimes n a <> stimes n b"
126-
(\(a,b,n) -> stimes n a <> stimes n b)
126+
(\(a, b, Positive n) -> stimes n a <> stimes n b)
127127

128128
semigroupIdempotent :: forall a. (Semigroup a, Eq a, Arbitrary a, Show a) => Proxy a -> Property
129129
semigroupIdempotent _ = myForAllShrink False (const True)

0 commit comments

Comments
 (0)