From dd0b0322fc261b85180988b41f17aed9115c0a15 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Tue, 26 Jul 2016 14:56:02 -0400 Subject: [PATCH] Add a property demonstrating the relationship between `sequenceAlt` over `[Maybe a]` & `pure . catMaybes`. --- test/Data/Mergeable/Spec.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/Data/Mergeable/Spec.hs b/test/Data/Mergeable/Spec.hs index 9f51c3994..cd0013246 100644 --- a/test/Data/Mergeable/Spec.hs +++ b/test/Data/Mergeable/Spec.hs @@ -25,6 +25,9 @@ spec = parallel $ do withAlternativeInstances sequenceAltLaws (sized (syntaxOfSize (const arbitrary)) :: Gen (Syntax Char Char)) withAlternativeInstances mergeLaws (sized (syntaxOfSize (const arbitrary)) :: Gen (Syntax Char Char)) + prop "subsumes catMaybes/Just" $ do + \ a -> sequenceAlt a `shouldBe` pure (catMaybes (a :: [Maybe Char])) + mergeLaws :: forall f g a. (Mergeable f, Alternative g, Eq (g (f a)), Show (f a), Show (g (f a))) => Gen (f a) -> Gen (Blind (a -> g a)) -> Spec mergeLaws value function = describe "merge" $ do prop "identity" . forAll value $