1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Define a ToJSONFields instance for JSONFields.

This commit is contained in:
Rob Rix 2017-09-10 22:40:13 -04:00
parent fb26ef6b34
commit 475e12d038

View File

@ -40,7 +40,10 @@ instance (ToJSONFields1 f, ToJSONFields1 g) => ToJSONFields1 (f :*: g) where
newtype JSONFields a = JSONFields { unJSONFields :: a }
instance (ToJSONFields a) => ToJSON (JSONFields a) where
instance ToJSONFields a => ToJSONFields (JSONFields a) where
toJSONFields = toJSONFields . unJSONFields
instance ToJSONFields a => ToJSON (JSONFields a) where
toJSON = object . toJSONFields . unJSONFields
toEncoding = pairs . mconcat . toJSONFields . unJSONFields