git.iko.soy/typeable/bloodhound
on master help sign in
V1 ditto
commit35f1de13e3a794d584262ddaa105dab7740b6f44 authorChris Allen <cma@bitemyapp.com> dateSun 24 Dec 2017, 14:00 (9 years ago) parent62959bc
1 file changed+11
tests/V1/tests.hs+11
tests/V1/tests.hs+11
@@ -717,6 +717,17 @@ instance Arbitrary FieldName where
717717 shrink = genericShrink
718718
719719
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+
720731instance Arbitrary RegexpFlags where
721732 arbitrary = oneof [ pure AllRegexpFlags
722733 , pure NoRegexpFlags