@@ -17,6 +17,7 @@ import qualified Prelude
17
17
import qualified Data.List
18
18
import Test.QuickCheck hiding ((><) )
19
19
import Test.QuickCheck.Poly
20
+ import Test.QuickCheck.Function
20
21
import Test.Framework
21
22
import Test.Framework.Providers.QuickCheck2
22
23
@@ -93,6 +94,9 @@ main = defaultMain
93
94
, testProperty " zipWith3" prop_zipWith3
94
95
, testProperty " zip4" prop_zip4
95
96
, testProperty " zipWith4" prop_zipWith4
97
+ , testProperty " <*>" prop_ap
98
+ , testProperty " *>" prop_then
99
+ , testProperty " >>=" prop_bind
96
100
]
97
101
98
102
------------------------------------------------------------------------
@@ -588,6 +592,22 @@ prop_zipWith4 xs ys zs ts =
588
592
toList' (zipWith4 f xs ys zs ts) ~= Data.List. zipWith4 f (toList xs) (toList ys) (toList zs) (toList ts)
589
593
where f = (,,,)
590
594
595
+ -- Applicative operations
596
+
597
+ prop_ap :: Seq A -> Seq B -> Bool
598
+ prop_ap xs ys =
599
+ toList' ((,) <$> xs <*> ys) ~= ( (,) <$> toList xs <*> toList ys )
600
+
601
+ prop_then :: Seq A -> Seq B -> Bool
602
+ prop_then xs ys =
603
+ toList' (xs *> ys) ~= (toList xs *> toList ys)
604
+
605
+ -- Monad operations
606
+
607
+ prop_bind :: Seq A -> Fun A (Seq B ) -> Bool
608
+ prop_bind xs (Fun _ f) =
609
+ toList' (xs >>= f) ~= (toList xs >>= toList . f)
610
+
591
611
-- Simple test monad
592
612
593
613
data M a = Action Int a
0 commit comments