mirror of
https://github.com/github/semantic.git
synced 2025-01-08 08:30:27 +03:00
Define ToJSONList instances over records.
This commit is contained in:
parent
a044e862b2
commit
3124447ad6
@ -72,6 +72,12 @@ instance ToJSON (Record '[]) where
|
|||||||
class ToJSONList t where
|
class ToJSONList t where
|
||||||
toJSONValues :: t -> [Value]
|
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
|
instance (Eq h, Eq (Record t)) => Eq (Record (h ': t)) where
|
||||||
RCons h1 t1 == RCons h2 t2 = h1 == h2 && t1 == t2
|
RCons h1 t1 == RCons h2 t2 = h1 == h2 && t1 == t2
|
||||||
|
Loading…
Reference in New Issue
Block a user