on master help sign in
Merge pull request #482 from phadej/proxy-one
c149038Adam Bergmark
Data/Aeson/Types/FromJSON.hs+9
@@ -1725,12 +1725,21 @@ instance FromJSON a => FromJSON (Semigroup.Option a) where
1725-- tagged
1725-- tagged
1726-------------------------------------------------------------------------------
1726-------------------------------------------------------------------------------
1727
1727
1728+instance FromJSON1 Proxy where
1729+ {-# INLINE liftParseJSON #-}
1730+ liftParseJSON _ _ Null = pure Proxy
1731+ liftParseJSON _ _ v = typeMismatch "Proxy" v
1732+
1728instance FromJSON (Proxy a) where
1733instance FromJSON (Proxy a) where
1729 {-# INLINE parseJSON #-}
1734 {-# INLINE parseJSON #-}
1730 parseJSON Null = pure Proxy
1735 parseJSON Null = pure Proxy
1731 parseJSON v = typeMismatch "Proxy" v
1736 parseJSON v = typeMismatch "Proxy" v
1732
1737
1733
1738
1739+instance FromJSON2 Tagged where
1740+ liftParseJSON2 _ _ p _ = fmap Tagged . p
1741+ {-# INLINE liftParseJSON2 #-}
1742+
1734instance FromJSON1 (Tagged a) where
1743instance FromJSON1 (Tagged a) where
1735 liftParseJSON p _ = fmap Tagged . p
1744 liftParseJSON p _ = fmap Tagged . p
1736 {-# INLINE liftParseJSON #-}
1745 {-# INLINE liftParseJSON #-}
Data/Aeson/Types/ToJSON.hs+14−1
@@ -2174,6 +2174,13 @@ instance ToJSON a => ToJSON (Semigroup.Option a) where
2174-- tagged
2174-- tagged
2175-------------------------------------------------------------------------------
2175-------------------------------------------------------------------------------
2176
2176
2177+instance ToJSON1 Proxy where
2178+ liftToJSON _ _ _ = Null
2179+ {-# INLINE liftToJSON #-}
2180+
2181+ liftToEncoding _ _ _ = E.null_
2182+ {-# INLINE liftToEncoding #-}
2183+
2177instance ToJSON (Proxy a) where
2184instance ToJSON (Proxy a) where
2178 toJSON _ = Null
2185 toJSON _ = Null
2179 {-# INLINE toJSON #-}
2186 {-# INLINE toJSON #-}
@@ -2182,6 +2189,13 @@ instance ToJSON (Proxy a) where
2182 {-# INLINE toEncoding #-}
2189 {-# INLINE toEncoding #-}
2183
2190
2184
2191
2192+instance ToJSON2 Tagged where
2193+ liftToJSON2 _ _ t _ (Tagged x) = t x
2194+ {-# INLINE liftToJSON2 #-}
2195+
2196+ liftToEncoding2 _ _ t _ (Tagged x) = t x
2197+ {-# INLINE liftToEncoding2 #-}
2198+
2185instance ToJSON1 (Tagged a) where
2199instance ToJSON1 (Tagged a) where
2186 liftToJSON t _ (Tagged x) = t x
2200 liftToJSON t _ (Tagged x) = t x
2187 {-# INLINE liftToJSON #-}
2201 {-# INLINE liftToJSON #-}
@@ -2196,7 +2210,6 @@ instance ToJSON b => ToJSON (Tagged a b) where
2196 toEncoding = toEncoding1
2210 toEncoding = toEncoding1
2197 {-# INLINE toEncoding #-}
2211 {-# INLINE toEncoding #-}
2198
2212
2199−
2200instance ToJSONKey b => ToJSONKey (Tagged a b) where
2213instance ToJSONKey b => ToJSONKey (Tagged a b) where
2201 toJSONKey = contramapToJSONKeyFunction unTagged toJSONKey
2214 toJSONKey = contramapToJSONKeyFunction unTagged toJSONKey
2202 toJSONKeyList = contramapToJSONKeyFunction (fmap unTagged) toJSONKeyList
2215 toJSONKeyList = contramapToJSONKeyFunction (fmap unTagged) toJSONKeyList