1
1
mirror of https://github.com/github/semantic.git synced 2025-01-04 05:27:08 +03:00

Add a property demonstrating the relationship between sequenceAlt over [Maybe a] & pure . catMaybes.

This commit is contained in:
Rob Rix 2016-07-26 14:56:02 -04:00
parent cfb7361b9c
commit dd0b0322fc

View File

@ -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 $