From 35f1de13e3a794d584262ddaa105dab7740b6f44 Mon Sep 17 00:00:00 2001 From: Chris Allen Date: Sun, 24 Dec 2017 14:00:08 -0600 Subject: [PATCH] V1 ditto --- tests/V1/tests.hs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/V1/tests.hs b/tests/V1/tests.hs index bd7d670..3c50431 100644 --- a/tests/V1/tests.hs +++ b/tests/V1/tests.hs @@ -717,6 +717,17 @@ instance Arbitrary FieldName where shrink = genericShrink +#if MIN_VERSION_base(4,10,0) +-- Test.QuickCheck.Modifiers + +qcNonEmptyToNonEmpty :: NonEmptyList a -> NonEmpty a +qcNonEmptyToNonEmpty (NonEmpty (a : xs)) = (a :| xs) +qcNonEmptyToNonEmpty (NonEmpty []) = error "NonEmpty was empty!" + +instance Arbitrary a => Arbitrary (NonEmpty a) where + arbitrary = qcNonEmptyToNonEmpty <$> arbitrary +#endif + instance Arbitrary RegexpFlags where arbitrary = oneof [ pure AllRegexpFlags , pure NoRegexpFlags