genericArbitrary (2 % 3 % 5 % ()) :: Gen aPicks the first constructor with probability 2/10, the second with probability 3/10, the third with probability 5/10.
data X = ... deriving Arbitrary via (GenericArbitrary '[2, 3, 5] X)Picks the first constructor with probability 2/10, the second with probability 3/10, the third with probability 5/10. This newtype does no shrinking. To add generic shrinking, use AndShrinking. Uses genericArbitrary.
data Foo = Foo { _fooX :: X , _fooY :: Y } deriving (Generic) deriving (Arbitrary) via GenericArbitrary Foo
genericArbitraryG customGens (17 % 19 % ())where, the generators for String and Int fields are overridden as follows, for example:
customGens :: Gen String :+ Gen Int customGens = (filter (/= 'NUL') <$> arbitrary) :+ (getNonNegative <$> arbitrary)
genericArbitrarySingle :: Gen a
genericArbitraryU :: Gen a
genericArbitraryU' :: Gen aN.B.: This replaces the generator for fields of type [t] with listOf' arbitrary instead of listOf arbitrary (i.e., arbitrary for lists).
data X = ... deriving Arbitrary via (GenericArbitraryG CustomGens '[2, 3, 5] X)where, for example, custom generators to override String and Int fields might look as follows:
type CustomGens = CustomString :+ CustomInt
data X = ... deriving Arbitrary via (GenericArbitraryRec '[2, 3, 5] X)N.B.: This replaces the generator for fields of type [t] with listOf' arbitrary instead of listOf arbitrary (i.e., arbitrary for lists). This newtype does no shrinking. To add generic shrinking, use AndShrinking. Uses genericArbitraryRec.