@@ -1,6 +1,7 @@
11module Regression.T1 (test1) where
22
33import Ether
4+import Data.List (group)
45
56import Test.Tasty
67import Test.Tasty.QuickCheck
@@ -23,6 +24,10 @@ testEther = do
2324
2425runner1 s1 s2 = flip (runReader @Tag1) s1 . flip (runReaderT @Tag2) s2
2526runner2 s1 s2 = flip (runReader @Tag2) s2 . flip (runReaderT @Tag1) s1
27+runner3 s1 s2 = flip runReaders (Tagged @Tag1 s1, Tagged @Tag2 s2)
28+
29+same :: Eq a => [a] -> Bool
30+same = (<=1) . length . group
2631
2732test1 :: TestTree
2833test1 = testGroup "T1: Reader local environment"
@@ -32,7 +37,13 @@ test1 = testGroup "T1: Reader local environment"
3237 , testProperty "runner₂ works"
3338 $ \s1 s2 -> property
3439 $ runner2 s1 s2 testEther == ((s1, s2), (s1, map succ s2))
35− , testProperty "runner₁ == runner₂"
40+ , testProperty "runner₃ works"
41+ $ \s1 s2 -> property
42+ $ runner3 s1 s2 testEther == ((s1, s2), (s1, map succ s2))
43+ , testProperty "runner₁ == runner₂ == runner₃"
3644 $ \s1 s2 -> property
37− $ runner1 s1 s2 testEther == runner2 s1 s2 testEther
45+ $ same
46+ [ runner1 s1 s2 testEther
47+ , runner2 s1 s2 testEther
48+ , runner3 s1 s2 testEther ]
3849 ]