on master help sign in
Merge pull request #444 from RyanGlScott/master

Fix generic instances involving type parameters in recursive positions

commit923694f019b25c75de76701627daa56252785a15 authorAdam Bergmark <adam@bergmark.nl> dateFri 8 Jul 2016, 14:16 (10 years ago) parent4904205715af32
5 files changed+10−2
Data/Aeson/Types/Generic.hs+2 tests/DataFamilies/Instances.hs+1 tests/DataFamilies/Types.hs+3−1 tests/Instances.hs+1 tests/Types.hs+3−1
Data/Aeson/Types/Generic.hs+2
@@ -47,6 +47,7 @@ instance OVERLAPPING_ IsRecord (M1 S NoSelector f) False
4747instance (IsRecord f isRecord) => IsRecord (M1 S c f) isRecord
4848instance IsRecord (K1 i c) True
4949instance IsRecord Par1 True
50+instance IsRecord (Rec1 f) True
5051instance IsRecord (f :.: g) True
5152instance IsRecord U1 False
5253 where isUnary = const False
@@ -64,6 +65,7 @@ instance AllNullary (a :*: b) False
6465instance AllNullary (a :.: b) False
6566instance AllNullary (K1 i c) False
6667instance AllNullary Par1 False
68+instance AllNullary (Rec1 f) False
6769instance AllNullary U1 True
6870
6971newtype Tagged2 (s :: * -> *) b = Tagged2 {unTagged2 :: b}
tests/DataFamilies/Instances.hs+1
@@ -24,6 +24,7 @@ instance Arbitrary a => Arbitrary (SomeType c () a) where
2424 , Unary <$> arbitrary
2525 , Product <$> arbitrary <*> arbitrary <*> arbitrary
2626 , Record <$> arbitrary <*> arbitrary <*> arbitrary
27+ , List <$> arbitrary
2728 ]
2829
2930instance Arbitrary (GADT String) where
tests/DataFamilies/Types.hs+3−1
@@ -24,7 +24,9 @@ data instance SomeType c () a = Nullary
2424 | Record { testOne :: Double
2525 , testTwo :: Maybe Bool
2626 , testThree :: Maybe a
27− } deriving (Eq, Show)
27+ }
28+ | List [a]
29+ deriving (Eq, Show)
2830
2931data family Approx a
3032newtype instance Approx a = Approx { fromApprox :: a }
tests/Instances.hs+1
@@ -153,6 +153,7 @@ instance Arbitrary a => Arbitrary (SomeType a) where
153153 , Unary <$> arbitrary
154154 , Product <$> arbitrary <*> arbitrary <*> arbitrary
155155 , Record <$> arbitrary <*> arbitrary <*> arbitrary
156+ , List <$> arbitrary
156157 ]
157158
158159instance Arbitrary EitherTextInt where
tests/Types.hs+3−1
@@ -63,7 +63,9 @@ data SomeType a = Nullary
6363 | Record { testOne :: Double
6464 , testTwo :: Maybe Bool
6565 , testThree :: Maybe a
66− } deriving (Eq, Show)
66+ }
67+ | List [a]
68+ deriving (Eq, Show)
6769
6870-- Used for testing UntaggedValue SumEncoding
6971data EitherTextInt