1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Generalize the Arbitrary instance over Records of multiple fields.

This commit is contained in:
Rob Rix 2016-07-13 15:24:35 -04:00
parent 2d4dadb167
commit 636fbd102b

View File

@ -61,7 +61,7 @@ instance Ord (Record '[]) where
_ `compare` _ = EQ
instance Arbitrary fields => Arbitrary (Record '[fields]) where
arbitrary = RCons <$> arbitrary <*> pure RNil
instance (Arbitrary field, Arbitrary (Record fields)) => Arbitrary (Record (field ': fields)) where
arbitrary = RCons <$> arbitrary <*> arbitrary
shrink (RCons h t) = RCons <$> shrink h <*> pure t
shrink (RCons h t) = RCons <$> shrink h <*> shrink t