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