@@ -235,7 +235,7 @@ constructWithFromIndicesM op len =
235-------------------------------------------------------------------------------
235-------------------------------------------------------------------------------
237applicativeOps
237applicativeOps
238− :: Applicative (t IO)
238+ :: (Applicative (t IO), Semigroup (t IO Int))
239 => ([Int] -> t IO Int)
239 => ([Int] -> t IO Int)
240 -> String
240 -> String
241 -> ([(Int, Int)] -> [(Int, Int)] -> Bool)
241 -> ([(Int, Int)] -> [(Int, Int)] -> Bool)
@@ -250,6 +250,14 @@ applicativeOps constr desc eq t = do
250 (\a b -> t ((,) <$> a <*> b))
250 (\a b -> t ((,) <$> a <*> b))
251 prop (desc <> " liftA2") $
251 prop (desc <> " liftA2") $
252 transformFromList2 constr eq (liftA2 (,)) (\a b -> t $ liftA2 (,) a b)
252 transformFromList2 constr eq (liftA2 (,)) (\a b -> t $ liftA2 (,) a b)
253+ prop (desc <> " Apply - composed first argument") $
255+ (S.toList . t) ((,) <$> (pure 1 <> pure 2) <*> pure 3) `shouldReturn`
257+ prop (desc <> " Apply - composed second argument") $
259+ (S.toList . t) ((,) <$> pure 1 <*> (pure 2 <> pure 3)) `shouldReturn`
254-- XXX we can combine this with applicativeOps by making the type sufficiently
262-- XXX we can combine this with applicativeOps by making the type sufficiently
255-- polymorphic.
263-- polymorphic.
@@ -452,11 +460,12 @@ functorOps
453functorOps constr desc eq t = do
461functorOps constr desc eq t = do
454 prop (desc <> " id") $ transformFromList constr eq id t
462 prop (desc <> " id") $ transformFromList constr eq id t
463+ prop (desc <> " fmap (+1)") $
455− prop (desc <> " fmap (+1)") $ transformFromList constr eq (fmap (+1)) $ t . fmap (+1)
464+ transformFromList constr eq (fmap (+ 1)) $ t . fmap (+ 1)
456−
465+ prop (desc <> " fmap on composed (<>)") $
457−-------------------------------------------------------------------------------
466+ sort <$>
458−-- Semigroup operations
467+ (S.toList . t) (fmap (+ 1) (constr [1] <> constr [2])) `shouldReturn`
459−-------------------------------------------------------------------------------
468+ ([2, 3] :: [Int])
461transformFromList
470transformFromList
462 :: (Eq b, Show b) =>
471 :: (Eq b, Show b) =>
@@ -472,6 +481,11 @@ transformFromList constr eq listOp op a =
472 let list = listOp a
481 let list = listOp a
473 listEquals eq stream list
482 listEquals eq stream list
485+-------------------------------------------------------------------------------
486+-- Semigroup operations
487+-------------------------------------------------------------------------------
475foldFromList
489foldFromList
476 :: ([Int] -> t IO Int)
490 :: ([Int] -> t IO Int)
477 -> (t IO Int -> SerialT IO Int)
491 -> (t IO Int -> SerialT IO Int)