This commit is contained in:
Chris Allen 2017-12-24 14:00:08 -06:00
parent 62959bcbfe
commit 35f1de13e3

View File

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