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