diff --git a/src/Data/JSON/Fields.hs b/src/Data/JSON/Fields.hs index 56d88c3a2..3b8402eb2 100644 --- a/src/Data/JSON/Fields.hs +++ b/src/Data/JSON/Fields.hs @@ -9,3 +9,6 @@ class ToJSONFields a where instance ToJSONFields a => ToJSONFields (Join (,) a) where toJSONFields (Join (a, b)) = [ "before" .= object (toJSONFields a), "after" .= object (toJSONFields b) ] + +instance ToJSONFields a => ToJSONFields (Maybe a) where + toJSONFields = maybe [] toJSONFields diff --git a/src/Renderer/JSON.hs b/src/Renderer/JSON.hs index b69606882..6c5112517 100644 --- a/src/Renderer/JSON.hs +++ b/src/Renderer/JSON.hs @@ -59,9 +59,6 @@ instance (ToJSONFields a, ToJSONFields (f (Term f a))) => ToJSON (Term f a) wher instance ToJSONFields Category where toJSONFields c = ["category" .= case c of { Other s -> s ; _ -> pack (show c) }] -instance ToJSONFields a => ToJSONFields (Maybe a) where - toJSONFields = maybe [] toJSONFields - instance (ToJSONFields a, ToJSONFields (f (Term f a))) => ToJSONFields (Term f a) where toJSONFields = toJSONFields . unTerm