mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Define a ToJSONFields instance for CofreeF.
This commit is contained in:
parent
607d4f0398
commit
3bf4f63e0c
@ -99,8 +99,11 @@ instance ToJSONFields Category where
|
||||
instance ToJSONFields a => ToJSONFields (Maybe a) where
|
||||
toJSONFields = maybe [] toJSONFields
|
||||
|
||||
instance (ToJSONFields a, ToJSONFields (f (Term f a))) => ToJSONFields (Term f a) where
|
||||
toJSONFields term = let a :< f = runCofree term in toJSONFields a <> toJSONFields f
|
||||
instance (ToJSONFields a, ToJSONFields (f (Cofree f a))) => ToJSONFields (Cofree f a) where
|
||||
toJSONFields = toJSONFields . runCofree
|
||||
|
||||
instance (ToJSONFields a, ToJSONFields (f b)) => ToJSONFields (CofreeF f a b) where
|
||||
toJSONFields (a :< f) = toJSONFields a <> toJSONFields f
|
||||
|
||||
instance ToJSON a => ToJSONFields (SplitPatch a) where
|
||||
toJSONFields (SplitInsert a) = [ "insert" .= a ]
|
||||
|
Loading…
Reference in New Issue
Block a user