mirror of
https://github.com/github/semantic.git
synced 2025-01-03 04:51:57 +03:00
Define a JSONFields1 bridge for ToJSON instances.
This commit is contained in:
parent
f43dc62d12
commit
f8f3e6466d
@ -35,3 +35,10 @@ newtype JSONFields a = JSONFields { unJSONFields :: a }
|
|||||||
instance (ToJSONFields a) => ToJSON (JSONFields a) where
|
instance (ToJSONFields a) => ToJSON (JSONFields a) where
|
||||||
toJSON = object . toJSONFields . unJSONFields
|
toJSON = object . toJSONFields . unJSONFields
|
||||||
toEncoding = pairs . mconcat . toJSONFields . unJSONFields
|
toEncoding = pairs . mconcat . toJSONFields . unJSONFields
|
||||||
|
|
||||||
|
|
||||||
|
newtype JSONFields1 f a = JSONFields1 { unJSONFields1 :: f a }
|
||||||
|
|
||||||
|
instance (ToJSON a, ToJSONFields1 f) => ToJSON (JSONFields1 f a) where
|
||||||
|
toJSON = object . toJSONFields1 . unJSONFields1
|
||||||
|
toEncoding = pairs . mconcat . toJSONFields1 . unJSONFields1
|
||||||
|
Loading…
Reference in New Issue
Block a user