@@ -1016,30 +1016,18 @@ instance (FromJSON a) => GFromJSON arity (K1 i a) where
1016
1016
gParseJSON _opts _ = fmap K1 . parseJSON
1017
1017
{-# INLINE gParseJSON #-}
1018
1018
1019
- instance FromJSON a => GOmitFromJSON arity (K1 i a ) where
1020
- gOmittedField _ = fmap K1 omittedField
1021
- {-# INLINE gOmittedField #-}
1022
-
1023
1019
instance GFromJSON One Par1 where
1024
1020
-- Direct occurrences of the last type parameter are decoded with the
1025
1021
-- function passed in as an argument:
1026
1022
gParseJSON _opts (From1Args _ pj _) = fmap Par1 . pj
1027
1023
{-# INLINE gParseJSON #-}
1028
1024
1029
- instance GOmitFromJSON One Par1 where
1030
- gOmittedField (From1Args o _ _) = fmap Par1 o
1031
- {-# INLINE gOmittedField #-}
1032
-
1033
1025
instance (FromJSON1 f ) => GFromJSON One (Rec1 f ) where
1034
1026
-- Recursive occurrences of the last type parameter are decoded using their
1035
1027
-- FromJSON1 instance:
1036
1028
gParseJSON _opts (From1Args o pj pjl) = fmap Rec1 . liftParseJSON o pj pjl
1037
1029
{-# INLINE gParseJSON #-}
1038
1030
1039
- instance FromJSON1 f => GOmitFromJSON One (Rec1 f ) where
1040
- gOmittedField (From1Args o _ _) = fmap Rec1 $ liftOmittedField o
1041
- {-# INLINE gOmittedField #-}
1042
-
1043
1031
instance (FromJSON1 f , GFromJSON One g ) => GFromJSON One (f :.: g ) where
1044
1032
-- If an occurrence of the last type parameter is nested inside two
1045
1033
-- composed types, it is decoded by using the outermost type's FromJSON1
@@ -1052,6 +1040,18 @@ instance (FromJSON1 f, GFromJSON One g) => GFromJSON One (f :.: g) where
1052
1040
in fmap Comp1 . liftParseJSON Nothing gpj (listParser gpj)
1053
1041
{-# INLINE gParseJSON #-}
1054
1042
1043
+ instance FromJSON a => GOmitFromJSON arity (K1 i a ) where
1044
+ gOmittedField _ = fmap K1 omittedField
1045
+ {-# INLINE gOmittedField #-}
1046
+
1047
+ instance GOmitFromJSON One Par1 where
1048
+ gOmittedField (From1Args o _ _) = fmap Par1 o
1049
+ {-# INLINE gOmittedField #-}
1050
+
1051
+ instance FromJSON1 f => GOmitFromJSON One (Rec1 f ) where
1052
+ gOmittedField (From1Args o _ _) = fmap Rec1 $ liftOmittedField o
1053
+ {-# INLINE gOmittedField #-}
1054
+
1055
1055
instance (FromJSON1 f , GOmitFromJSON One g ) => GOmitFromJSON One (f :.: g ) where
1056
1056
gOmittedField = fmap Comp1 . liftOmittedField . gOmittedField
1057
1057
{-# INLINE gOmittedField #-}
0 commit comments