From 3124447ad661d0699c65902b94fcbdf780e293c4 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Thu, 12 Jan 2017 14:23:18 -0500 Subject: [PATCH] Define ToJSONList instances over records. --- src/Data/Record.hs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Data/Record.hs b/src/Data/Record.hs index e93f26c73..103e823d5 100644 --- a/src/Data/Record.hs +++ b/src/Data/Record.hs @@ -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