1
1
mirror of https://github.com/github/semantic.git synced 2025-01-05 14:11:33 +03:00

Define ToJSONList instances over records.

This commit is contained in:
Rob Rix 2017-01-12 14:23:18 -05:00
parent a044e862b2
commit 3124447ad6

View File

@ -72,6 +72,12 @@ instance ToJSON (Record '[]) where
class ToJSONList t where
toJSONValues :: t -> [Value]
instance (ToJSON h, ToJSONList (Record t)) => ToJSONList (Record (h ': t)) where
toJSONValues (RCons h t) = toJSON h : toJSONValues t
instance ToJSONList (Record '[]) where
toJSONValues _ = []
instance (Eq h, Eq (Record t)) => Eq (Record (h ': t)) where
RCons h1 t1 == RCons h2 t2 = h1 == h2 && t1 == t2