avoid Arbitrary generating excessivly long lists

Turns what it was doing often generated too long lists, or spun with
suchThat rejecting too large numbers. Limit lists to 10.
This commit is contained in:
Joey Hess 2019-01-21 13:40:11 -04:00
parent e15d18058b
commit f76c4a0973
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 5 additions and 6 deletions

View file

@ -23,7 +23,8 @@ data View = View
deriving (Eq, Read, Show)
instance Arbitrary View where
arbitrary = View <$> pure (Git.Ref "master") <*> arbitrary
arbitrary = View (Git.Ref "master")
<$> resize 10 (listOf arbitrary)
data ViewComponent = ViewComponent
{ viewField :: MetaField
@ -43,8 +44,7 @@ data ViewFilter
instance Arbitrary ViewFilter where
arbitrary = do
size <- arbitrarySizedBoundedIntegral `suchThat` (< 100)
s <- S.fromList <$> vector size
s <- S.fromList <$> resize 10 (listOf arbitrary)
ifM arbitrary
( return (FilterValues s)
, return (ExcludeValues s)