@@ -237,38 +237,50 @@ constructWithFromIndicesM op len =
237applicativeOps
237applicativeOps
238 :: Applicative (t IO)
238 :: Applicative (t IO)
239 => ([Int] -> t IO Int)
239 => ([Int] -> t IO Int)
240 -> ([(Int, Int)] -> [(Int, Int)] -> Bool)
241 -> ([(Int, Int)] -> [(Int, Int)] -> Bool)
241 -> (t IO (Int, Int) -> SerialT IO (Int, Int))
242 -> (t IO (Int, Int) -> SerialT IO (Int, Int))
242− -> ([Int], [Int])
243+ -> Spec
244−applicativeOps constr eq t (a, b) = withMaxSuccess maxTestCount $
244+applicativeOps constr desc eq t = do
245− monadicIO $ do
245+ prop (desc <> " <*>") $
246− stream <- run ((S.toList . t) ((,) <$> constr a <*> constr b))
246+ transformFromList2
247− let list = (,) <$> a <*> b
247+ constr
248− listEquals eq stream list
248+ eq
249−
249+ (\a b -> (,) <$> a <*> b)
250− stream1 <- run ((S.toList . t) (liftA2 (,) (constr a) (constr b)))
250+ (\a b -> t ((,) <$> a <*> b))
251− listEquals eq stream1 list
251+ prop (desc <> " liftA2") $
252+ transformFromList2 constr eq (liftA2 (,)) (\a b -> t $ liftA2 (,) a b)
253-- XXX we can combine this with applicativeOps by making the type sufficiently
254-- XXX we can combine this with applicativeOps by making the type sufficiently
254-- polymorphic.
255-- polymorphic.
255applicativeOps1
256applicativeOps1
256 :: Applicative (t IO)
257 :: Applicative (t IO)
257 => ([Int] -> t IO Int)
258 => ([Int] -> t IO Int)
258 -> ([Int] -> [Int] -> Bool)
260 -> ([Int] -> [Int] -> Bool)
259 -> (t IO Int -> SerialT IO Int)
261 -> (t IO Int -> SerialT IO Int)
260− -> ([Int], [Int])
262+ -> Spec
261− -> Property
263+applicativeOps1 constr desc eq t = do
264+ prop (desc <> " *>") $
265+ transformFromList2 constr eq (*>) (\a b -> t (a *> b))
266+ prop (desc <> " <*") $
267+ transformFromList2 constr eq (<*) (\a b -> t (a <* b))
272+ -> ([c] -> [c] -> Bool)
273+ -> ([a] -> [a] -> [c])
274+ -> (t IO a -> t IO a -> SerialT IO c)
277+transformFromList2 constr eq listOp op (a, b) =
262−applicativeOps1 constr eq t (a, b) = withMaxSuccess maxTestCount $
278+ withMaxSuccess maxTestCount $
263 monadicIO $ do
279 monadicIO $ do
264− stream <- run ((S.toList . t) (constr a *> constr b))
280+ stream <- run (S.toList $ op (constr a) (constr b))
265− let list = a *> b
281+ let list = listOp a b
266 listEquals eq stream list
282 listEquals eq stream list
268− stream1 <- run ((S.toList . t) (constr a <* constr b))
270− listEquals eq stream1 list1
272-------------------------------------------------------------------------------
284-------------------------------------------------------------------------------
273-- Elimination operations
285-- Elimination operations
274-------------------------------------------------------------------------------
286-------------------------------------------------------------------------------
@@ -432,7 +444,7 @@ eliminationOpsWord8 constr desc t = do
432-------------------------------------------------------------------------------
444-------------------------------------------------------------------------------
434functorOps
446functorOps
435− :: Functor (t IO)
447+ :: (Functor (t IO), Semigroup (t IO Int))
436 => ([Int] -> t IO Int)
448 => ([Int] -> t IO Int)
437 -> String
449 -> String
438 -> ([Int] -> [Int] -> Bool)
450 -> ([Int] -> [Int] -> Bool)