From 636fbd102b2a300e302f9b2cb0453099864f0fe8 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Wed, 13 Jul 2016 15:24:35 -0400 Subject: [PATCH] Generalize the Arbitrary instance over Records of multiple fields. --- src/Data/Record.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Data/Record.hs b/src/Data/Record.hs index 5d6043771..885c11dbf 100644 --- a/src/Data/Record.hs +++ b/src/Data/Record.hs @@ -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