git.iko.soy/typeable/bloodhound
on master help sign in
V1 ditto
35f1de1Chris Allen
tests/V1/tests.hs+11
@@ -717,6 +717,17 @@ instance Arbitrary FieldName where
717 shrink = genericShrink
717 shrink = genericShrink
718
718
719
719
720+#if MIN_VERSION_base(4,10,0)
721+-- Test.QuickCheck.Modifiers
722+
723+qcNonEmptyToNonEmpty :: NonEmptyList a -> NonEmpty a
724+qcNonEmptyToNonEmpty (NonEmpty (a : xs)) = (a :| xs)
725+qcNonEmptyToNonEmpty (NonEmpty []) = error "NonEmpty was empty!"
726+
727+instance Arbitrary a => Arbitrary (NonEmpty a) where
728+ arbitrary = qcNonEmptyToNonEmpty <$> arbitrary
729+#endif
730+
720instance Arbitrary RegexpFlags where
731instance Arbitrary RegexpFlags where
721 arbitrary = oneof [ pure AllRegexpFlags
732 arbitrary = oneof [ pure AllRegexpFlags
722 , pure NoRegexpFlags
733 , pure NoRegexpFlags